Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 21 months ago

Closed 21 months ago

#10926 closed Bug Report - Hang/Deadlock (fixed)

Deadlock on mythfrontend

Reported by: jyavenard Owned by: Daniel Kristjansson <danielk@…>
Priority: blocker Milestone: 0.26
Component: MythTV - General Version: Unspecified
Severity: medium Keywords:
Cc: Ticket locked: no

Description (last modified by jyavenard)

Fresh, new, blank system as per #10925.
Create new mythconverg database
run mythtv-setup and create a basic system (capture card, etc..)
run mythbackend

start mythfrontend
it prompts you to choose your language.
Save and mythfrontend now hangs.

It is deadlocked

void MythPainter::DeleteFormatImage(MythImage *im)
{
    m_allocationLock.lock();
    DeleteFormatImagePriv(im);

on m_allocationLock.lock();

(gdb) bt full
#0  0x00007fff8bc900fa in __psynch_cvwait ()
No symbol table info available.
#1  0x00007fff86c85fc9 in _pthread_cond_wait ()
No symbol table info available.
#2  0x0000000105df9f5b in QMutexPrivate::wait ()
No symbol table info available.
#3  0x0000000105df520c in QMutex::lockInternal ()
No symbol table info available.
#4  0x00000001029ba377 in MythPainter::DeleteFormatImage (this=0x10a62d7a0, im=0x110266d70) at mythpainter.cpp:521
No locals.
#5  0x00000001029be060 in MythImage::~MythImage (this=0x110266d70) at mythimage.cpp:59
No locals.
#6  0x00000001029cb0e5 in MythQtImage::~MythQtImage (this=0x110266d70) at mythpainter_qt.cpp:15
No locals.
#7  0x00000001029ca7b5 in MythQtImage::~MythQtImage (this=0x110266d70) at mythpainter_qt.cpp:15
No locals.
#8  0x00000001029ca7d8 in MythQtImage::~MythQtImage (this=0x110266d70) at mythpainter_qt.cpp:15
No locals.
#9  0x00000001029ca85c in non-virtual thunk to MythQtImage::~MythQtImage() () at mythpainter_qt.cpp:15
No symbol table info available.
#10 0x0000000102787b64 in ReferenceCounter::DecrRef (this=0x110266d88) at referencecounter.cpp:147
	val = 0
#11 0x00000001029be21e in MythImage::DecrRef (this=0x110266d70) at mythimage.cpp:73
	cached = false
	cnt = 134942768
#12 0x00000001029b686b in MythPainter::ExpireImages (this=0x10a62d7a0, max=0) at mythpainter.cpp:569
	oldmsg = {
  d = 0x110292000
}
	it = {
  i = 0x1080b1030
}
	oldim = (MythImage *) 0x110266d70
	recompute = false
#13 0x00000001029b62e3 in MythPainter::~MythPainter (this=0x10a62d7a0) at mythpainter.cpp:28
	locker = {
  val = 4469217233
}
#14 0x00000001029c9be2 in MythQtPainter::~MythQtPainter (this=0x10a62d7a0) at mythpainter_qt.cpp:65
No locals.
#15 0x00000001029c9b65 in MythQtPainter::~MythQtPainter (this=0x10a62d7a0) at mythpainter_qt.cpp:63
No locals.
#16 0x00000001029c9b18 in MythQtPainter::~MythQtPainter (this=0x10a62d7a0) at mythpainter_qt.cpp:63
No locals.
#17 0x00000001029a128c in MythMainWindow::ReinitDone (this=0x10a60d170) at mythmainwindow.cpp:1248
No locals.
#18 0x000000010000f60a in reloadTheme () at main.cpp:1230
	themename = {
  d = 0x108514d40
}
	themedir = {
  d = 0x1083d4020
}
	lcd = (LCD *) 0x100000000000001
#19 0x000000010000ced8 in main (argc=10, argv=0x7fff5fbff9f0) at main.cpp:1613
	bPromptForBackend = false
	cmdline = {
  <MythCommandLineParser> = {
    _vptr$MythCommandLineParser = 0x1003df560, 
    m_appname = {
      d = 0x10731d3c0
    }, 
    m_optionedArgs = {
      {
        d = 0x10731d950, 
        e = 0x10731d950
      }
    }, 
    m_namedArgs = {
      {
        d = 0x10731d890, 
        e = 0x10731d890
      }
    }, 
    m_passthroughActive = false, 
    m_overridesImported = true, 
    m_verbose = false
  }, <No data fields>}
	fileprefix = {
  d = 0x108345580
}
	bonjour = {
  d = 0x10a6266f0
}
	lcd = (LCD *) 0x0
	themename = {
  d = 0x108514d40
}
	mainWindow = (MythMainWindow *) 0x10a60d170
	sysEventHandler = (MythSystemEventHandler *) 0x0
	signallist = {
  {
    p = {
      d = 0x10a04e650
    }, 
    d = 0x10a04e650
  }
}
	handler = {
  <QObject> = {
    _vptr$QObject = 0x1028882b0, 
    d_ptr = {
      d = 0x10a04d490
    }
  }, 
  members of SignalHandler: 
  m_notifier = 0x10a04d560, 
  m_sigMap = {
    {
      d = 0x10830a7f0, 
      e = 0x10830a7f0
    }
  }
}
	retval = 0
	themedir = {
  d = 0x108062fe0
}
	themeUpdateChecker = (ThemeUpdateChecker *) 0x0
	bBypassAutoDiscovery = false
	mon = (MediaMonitor *) 0x0
	ret = 32767
	callCleanup = {
  m_cleanFunction = 0x10000ed00 <cleanup>
}
	ResetSettings = false
	dir = {
  d_ptr = {
    d = 0x10a625130
  }
}
	networkControl = (NetworkControl *) 0x0
	bcm = {
  <QObject> = {
    _vptr$QObject = 0x0, 
    d_ptr = {
      d = 0x0
    }
  }, 
  members of BackendConnectionManager: 
  m_reconnecting = 0x0, 
  m_reconnect_timer = 0x0
}
#20 0x000000010000b0e4 in start ()
No symbol table info available.

This deadlock can be reproduce by simply going into Settings -> Theme Chooser and downloading another theme.

Sometimes browsing Myth Videos will see the deadlock occurring too.

Attachments (0)

Change History (5)

comment:1 Changed 21 months ago by jyavenard

Killing mythfrontend and restarting it, it will run successfully this time

comment:2 Changed 21 months ago by beirdo

  • Type changed from Bug Report - General to Bug Report - Hang/Deadlock

comment:3 Changed 21 months ago by jyavenard

  • Description modified (diff)
  • Priority changed from critical to blocker
  • Summary changed from Deadlock on mythfrontend on first start to Deadlock on mythfrontend

comment:4 Changed 21 months ago by jyavenard

Suggested patch:

diff --git a/mythtv/libs/libmythui/mythpainter.cpp b/mythtv/libs/libmythui/mythpainter.cpp
index 4b5017c..f0abd99 100644
--- a/mythtv/libs/libmythui/mythpainter.cpp
+++ b/mythtv/libs/libmythui/mythpainter.cpp
@@ -23,10 +23,10 @@ MythPainter::MythPainter()
 
 MythPainter::~MythPainter(void)
 {
-    QMutexLocker locker(&m_allocationLock);
-
     ExpireImages(0);
 
+    QMutexLocker locker(&m_allocationLock);
+
     if (m_allocatedImages.isEmpty())
         return;
 

comment:5 Changed 21 months ago by Daniel Kristjansson <danielk@…>

  • Owner set to Daniel Kristjansson <danielk@…>
  • Resolution set to fixed
  • Status changed from new to closed

In e29f47d57c439ccbe6cac2476d8a616323eed44c/mythtv:

Fixes #10926. Safely teardown MythPainters?.

The deadlock was actually the least of our problems.
Since MythPainter::DeleteFormatImagePriv?() is a pure
virtual in MythPainter? calling ExpireImages?() in
the dtor is unsafe. This puts the teardown code
into a Teardown() method which is called from all
the child classes where it is safe to do the teardown.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.