[mythtv-commits] Ticket #9714: mythwelcome hanging (MythSystemUnix::Fork child QString use leads to possible deadlock)

MythTV noreply at mythtv.org
Fri Apr 8 01:51:11 UTC 2011

#9714: mythwelcome hanging (MythSystemUnix::Fork child QString use leads to
possible deadlock)
     Reporter:  naf@…                |      Owner:  beirdo
         Type:  Patch - Bug Fix      |     Status:  new
     Priority:  minor                |  Milestone:  unknown
    Component:  MythTV - MythSystem  |    Version:  Trunk Head
     Severity:  medium               |   Keywords:
Ticket locked:  0                    |
 I noticed mythwelcome sporadically hanging when calling mythstatus. Logs
 ended like:
 2011-04-07 20:08:19.377 Locking input devices
 2011-04-07 20:08:19.386 Launching: /usr/local/bin/mythshutdown --status 0
 2011-04-07 20:08:19.388 Managed child (PID: 27773) has started! *
 command=/usr/local/bin/mythshutdown --status 0, timeout=0

 Backtrace of the hung process looked like:
 #0  0x00007fe8f25d81ac in __lll_lock_wait () from /lib64/libpthread.so.0
 #1  0x00007fe8f25d34bf in _L_lock_1058 () from /lib64/libpthread.so.0
 #2  0x00007fe8f25d331b in pthread_mutex_lock () from
 #3  0x0000003c2d2978a9 in ?? () from /usr/lib64/libGL.so.1
 #4  0x0000003c2d29a8b9 in ?? () from /usr/lib64/libGL.so.1
 #5  0x0000003c2d29ace8 in ?? () from /usr/lib64/libGL.so.1
 #6  0x0000003c2da0098d in ?? () from /usr/lib64/tls/libnvidia-
 #7  0x00000031338b6623 in QString::fromLatin1_helper(char const*, int) ()
 from /usr/lib64/libQtCore.so.4
 #8  0x00000031338b92bd in QString::fromAscii_helper(char const*, int) ()
 from /usr/lib64/libQtCore.so.4
 #9  0x00007fe8f445902d in QString (this=0x1ffb5b0, timeout=0) at
 #10 GetSetting (this=0x1ffb5b0, timeout=0) at mythsystem.h:86
 #11 GetSetting (this=0x1ffb5b0, timeout=0) at mythsystem.h:147
 #12 MythSystemUnix::Fork (this=0x1ffb5b0, timeout=0) at system-
 #13 0x00007fe8f43d1732 in MythSystem::Run (this=0x201e6b0, timeout=0) at
 #14 0x00007fe8f43d58c6 in myth_system (command=..., flags=<value optimized
 out>, timeout=0) at mythsystem.cpp:368
 #15 0x0000000000404ba1 in isRunning (program=0x40f770 "mythtranscode") at
 #16 0x00000000004052a6 in getStatus (bWantRecStatus=false) at main.cpp:231
 #17 0x000000000040e8f1 in main (argc=3, argv=0x7fffeb559068) at

 So the deadlock was happening in MythSystemUnix::Fork() doing QString
 stuff during a call to GetSetting() between fork() and execl().

 It appears that bac42c09 fixed possible child deadlocks by removing all
 QString use between fork() and execl() [and added comments referencing
 their danger!], but another QString was reintroduced in 7bad51a1.

 Attached patch moves the GetSetting() call (and thus the use of QString)
 to before the fork(), which solved my intermittent mythwelcome freezes.

Ticket URL: <http://code.mythtv.org/trac/ticket/9714>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center

More information about the mythtv-commits mailing list