[mythtv-commits] Ticket #9016: mythbackend hangs due to all DVB-devices becoming busy & unavailable

MythTV mythtv at cvs.mythtv.org
Sun Sep 26 18:51:37 UTC 2010


#9016: mythbackend hangs due to all DVB-devices becoming busy & unavailable
--------------------------------------------------------+-------------------
 Reporter:  Tomi Orava <tomi.orava@…>                   |            Type:  defect          
   Status:  new                                         |        Priority:  minor           
Milestone:  unknown                                     |       Component:  MythTV - General
  Version:  Trunk Head                                  |        Severity:  medium          
 Keywords:                                              |   Ticket locked:  0               
--------------------------------------------------------+-------------------
 The current trunk has a some sort of locking problem that is somehow
 related to mythsystem.

 The following backtrace can always be seen (or something similar):

 (gdb) info thr
 * 1 Thread 0x7f805b7de710 (LWP 6878)  __lll_lock_wait_private () at
 ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:97
 (gdb) bt
 #0  __lll_lock_wait_private () at
 ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:97
 #1  0x00007f807a53844b in _L_lock_2076 () at tzset.c:138
 #2  0x00007f807a538331 in __tzset () at tzset.c:590
 #3  0x00007f807b055156 in QDateTime::currentDateTime() () from
 /usr/lib/libQtCore.so.4
 #4  0x00007f8081ac07e5 in myth_system_fork (command=...,
 result=@0x7f805b7dd66c) at mythsystem.cpp:373
 #5  0x00007f8081abfe2a in myth_system (command=..., flags=3, timeout=0) at
 mythsystem.cpp:251
 #6  0x00007f8083af78fb in PreviewGenerator::Run (this=0x7f8048762a80) at
 previewgenerator.cpp:244
 #7  0x00007f8083af9702 in PreviewGenerator::run (this=0x7f8048762a80) at
 previewgenerator.cpp:324
 #8  0x00007f807b047775 in ?? () from /usr/lib/libQtCore.so.4
 #9  0x00007f807cd8a9ca in start_thread (arg=<value optimized out>) at
 pthread_create.c:300
 #10 0x00007f807a5836fd in clone () at
 ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
 #11 0x0000000000000000 in ?? ()

 Unfortunately, I did not have a chance to retrieve a full backtrace of all
 the threads as of now. However, from past experiences (2-3 past weeks) it
 looks like if I break/hack the following change:


 {{{
 Index: libs/libmythdb/mythsystem.cpp
 ===================================================================
 --- libs/libmythdb/mythsystem.cpp       (revision 26296)
 +++ libs/libmythdb/mythsystem.cpp       (working copy)
 @@ -353,6 +353,14 @@
  {
      QString LOC_ERR = QString("myth_system('%1'): Error: ").arg(command);
      VERBOSE(VB_IMPORTANT, QString("Launching: %1") .arg(command));
 +
 +
 +    /* In case we forked WHILE it was locked */
 +    bool unlocked = verbose_mutex.tryLock();
 +    verbose_mutex.unlock();
 +    if( !unlocked )
 +        VERBOSE(VB_IMPORTANT, "Cleared parent's verbose lock");
 +
      pid_t child = fork();

      if (child < 0)
 @@ -366,11 +374,6 @@
      else if (child == 0)
      {
          /* Child */
 -        /* In case we forked WHILE it was locked */
 -        bool unlocked = verbose_mutex.tryLock();
 -        verbose_mutex.unlock();
 -        if( !unlocked )
 -            VERBOSE(VB_IMPORTANT, "Cleared parent's verbose lock");

          /* Close all open file descriptors except stdout/stderr */
          for (int i = sysconf(_SC_OPEN_MAX) - 1; i > 2; i--)

 }}}

 The hanging problem disappears. Of course the above patch is not a proper
 fix, but  somehow it is able to fix the problem for me.

 The following log entries might also be helpful:


 {{{
 010-09-26 21:00:41.327
 RingBuf(/net/alderan/mythtv/disk-1/recordings/1004_20100926210000.mpg)
 Warning: Taking too long to be allowed to read..
 2010-09-26 21:00:42.337
 RingBuf(/net/alderan/mythtv/disk-1/recordings/1004_20100926210000.mpg)
 Warning: Taking too long to be allowed to read..
 2010-09-26 21:00:42.735
 RingBuf(/net/alderan/mythtv/disk-1/recordings/1004_20100926210000.mpg)
 Warning: Taking too long to be allowed to read..
 2010-09-26 21:00:42.744
 RingBuf(/net/alderan/mythtv/disk-1/recordings/1004_20100926210000.mpg)
 Warning: Peek() requested 2048 bytes, but only returning 752
 2010-09-26 21:00:42.745 Player(0), Error: OpenFile(): Could not read first
 2048 bytes of
 '/net/alderan/mythtv/disk-1/recordings/1004_20100926210000.mpg'
 2010-09-26 21:00:43.755 ~MythContext waiting for threads to exit.
 2010-09-26 21:00:44.269 PID 7049: exited: status=0, result=0
 2010-09-26 21:00:44.320 Launching: /usr/bin/mythpreviewgen --size 0x0
 --chanid 1004 --starttime 20100926210000  > /dev/null
 2010-09-26 21:00:44.463 PID 7063: launched
 2010-09-26 21:00:44.732 MainServer::ANN Monitor
 2010-09-26 21:00:44.777 adding: alderan.ncircle.nullnet.fi as a client
 (events: 0)
 2010-09-26 21:00:44.778 MainServer::ANN Monitor
 2010-09-26 21:00:44.779 adding: alderan.ncircle.nullnet.fi as a client
 (events: 1)
 2010-09-26 21:00:44.819 PID 7063: exited: status=65280, result=255
 2010-09-26 21:00:44.838 Preview Error: Encountered problems running
 '/usr/bin/mythpreviewgen --size 0x0 --chanid 1004 --starttime
 20100926210000  > /dev/null'
 2010-09-26 21:00:44.845 commflag: Commercial Detection Finished: "Pirates
 of the Caribbean: Maailman laidalla (K13)" recorded from channel 1004 at
 2010-09-26T21:00:00 (0 commercial break(s))
 2010-09-26 21:01:03.156 Reschedule requested for id -1.
 2010-09-26 21:00:44.269 PID 7049: exited: status=0, result=0
 2010-09-26 21:00:44.320 Launching: /usr/bin/mythpreviewgen --size 0x0
 --chanid 1004 --starttime 20100926210000  > /dev/null
 2010-09-26 21:00:44.463 PID 7063: launched
 2010-09-26 21:00:44.732 MainServer::ANN Monitor
 2010-09-26 21:00:44.777 adding: alderan.ncircle.nullnet.fi as a client
 (events: 0)
 2010-09-26 21:00:44.778 MainServer::ANN Monitor
 2010-09-26 21:00:44.779 adding: alderan.ncircle.nullnet.fi as a client
 (events: 1)
 2010-09-26 21:00:44.819 PID 7063: exited: status=65280, result=255
 2010-09-26 21:00:44.838 Preview Error: Encountered problems running
 '/usr/bin/mythpreviewgen --size 0x0 --chanid 1004 --starttime
 20100926210000  > /dev/null'
 2010-09-26 21:00:44.845 commflag: Commercial Detection Finished: "Pirates
 of the Caribbean: Maailman laidalla (K13)" recorded from channel 1004 at
 2010-09-26T21:00:00 (0 commercial break(s))
 2010-09-26 21:01:03.156 Reschedule requested for id -1.
 2010-09-26 21:01:06.482 Scheduled 401 items in 3.3 = 0.15 match + 3.12
 place
 2010-09-26 21:01:06.504 scheduler: Scheduled items: Scheduled 401 items in
 3.3 = 0.15 match + 3.12 place
 2010-09-26 21:03:12.166 AutoExpire: CalcParams(): Max required Free Space:
 22.0 GB w/freq: 14 min
 2010-09-26 21:03:12.225 Expiring 1122 MBytes for 1001 at Fri Sep 24
 20:30:00 2010 => Tv-uutiset ja s<E4><E4>.  Too many episodes, we only want
 to keep 2.
 2010-09-26 21:03:12.230 autoexpire: Expired program: Expiring 1122 MBytes
 for 1001 at Fri Sep 24 20:30:00 2010 => Tv-uutiset ja sää.  Too many
 episodes, we only want to keep 2.
 2010-09-26 21:03:12.253 Reschedule requested for id 0.
 2010-09-26 21:03:12.774 Launching: /usr/bin/mythpreviewgen --size 0x0
 --chanid 1004 --starttime 20100926210000  > /dev/null
 2010-09-26 21:03:12.788 PID 7584: launched
 2010-09-26 21:03:13.067 MainServer::ANN Monitor
 2010-09-26 21:03:13.077 adding: alderan.ncircle.nullnet.fi as a client
 (events: 0)
 2010-09-26 21:03:13.078 MainServer::ANN Monitor
 2010-09-26 21:03:13.079 adding: alderan.ncircle.nullnet.fi as a client
 (events: 1)
 2010-09-26 21:03:13.117 PID 7584: exited: status=65280, result=255
 2010-09-26 21:03:13.120 Preview Error: Encountered problems running
 '/usr/bin/mythpreviewgen --size 0x0 --chanid 1004 --starttime
 20100926210000  > /dev/null'
 2010-09-26 21:03:15.562 Scheduled 401 items in 3.3 = 0.00 match + 3.25
 place
 2010-09-26 21:03:15.580 scheduler: Scheduled items: Scheduled 401 items in
 3.3 = 0.00 match + 3.25 place
 2010-09-26 21:03:23.297 Reschedule requested for id 0.
 2010-09-26 21:03:26.399 Scheduled 401 items in 3.0 = 0.05 match + 2.97
 place
 2010-09-26 21:03:26.416 scheduler: Scheduled items: Scheduled 401 items in
 3.0 = 0.05 match + 2.97 place
 2010-09-26 21:04:11.543 DVBSH(/dev/dvb/adapter2/frontend0): Failed to open
 DVR device /dev/dvb/adapter2/dvr0 : Device or resource busy
 2010-09-26 21:08:35.007 DVBSH(/dev/dvb/adapter2/frontend0): Failed to open
 DVR device /dev/dvb/adapter2/dvr0 : Device or resource busy
 2010-09-26 21:12:58.524 DVBSH(/dev/dvb/adapter2/frontend0): Failed to open
 DVR device /dev/dvb/adapter2/dvr0 : Device or resource busy
 2010-09-26 21:17:12.527 AutoExpire: CalcParams(): Max required Free Space:
 22.0 GB w/freq: 14 min
 2010-09-26 21:17:13.264 UPnpMedia: BuildMediaMap VIDEO scan starting in
 :/net/alderan/movies/:
 2010-09-26 21:17:13.573 UPnpMedia: BuildMediaMap Done. Found 331 objects
 2010-09-26 21:17:21.890 DVBSH(/dev/dvb/adapter2/frontend0): Failed to open
 DVR device /dev/dvb/adapter2/dvr0 : Device or resource busy
 2010-09-26 21:21:45.410 DVBSH(/dev/dvb/adapter2/frontend0): Failed to open
 DVR device /dev/dvb/adapter2/dvr0 : Device or resource busy
 2010-09-26 21:26:08.814 DVBSH(/dev/dvb/adapter2/frontend0): Failed to open
 DVR device /dev/dvb/adapter2/dvr0 : Device or resource busy
 2010-09-26 21:30:32.385 DVBSH(/dev/dvb/adapter2/frontend0): Failed to open
 DVR device /dev/dvb/adapter2/dvr0 : Device or resource busy
 2010-09-26 21:31:12.904 AutoExpire: CalcParams(): Max required Free Space:
 22.0 GB w/freq: 14 min
 2010-09-26 21:34:55.756 DVBSH(/dev/dvb/adapter2/frontend0): Failed to open
 DVR device /dev/dvb/adapter2/dvr0 : Device or resource busy
 2010-09-26 21:36:22.281 Launching: /usr/bin/mythpreviewgen --size 0x0
 --chanid 4350 --starttime 20100921233500  > /dev/null
 2010-09-26 21:36:22.303 PID 13439: launched
 2010-09-26 21:36:23.729 MainServer::ANN Monitor

 }}}


 MythTV Version   : 26474M
 MythTV Branch    : trunk
 Network Protocol : 62
 Library API      : 0.23.20100917-1
 QT Version       : 4.6.2
 Options compiled in:
  linux debug using_alsa using_jack using_oss using_pulse using_pulseoutput
 using_backend using_bindings_perl using_bindings_python using_directfb
 using_dvb using_frontend using_hdhomerun using_hdpvr using_iptv
 using_joystick_menu using_libfftw3 using_lirc using_mheg
 using_opengl_video using_opengl_vsync using_qtdbus using_qtwebkit
 using_v4l using_x11 using_xrandr using_xv using_xvmc using_xvmc_vld
 using_xvmcw using_bindings_perl using_bindings_python using_mythtranscode
 using_opengl using_vdpau using_ffmpeg_threads using_live using_mheg

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/9016>
MythTV <http://www.mythtv.org/>
MythTV Media Center


More information about the mythtv-commits mailing list