[mythtv] mythbackend crashes with segmentation fault after the specific sequences of events.

Mudit Wahal mwahal at gmail.com
Fri Jun 17 01:29:29 UTC 2005


Isaac,

As per you suggestions, I removed the second Announce of playback. Now
I've only one playback and one ringbuffer announce. I'm able to run my
script multiple times without crashing the mythbackend !

But when I did Ctrl-C to stop by script, it stopped when it was trying
to change the channel. Seems like it also managed to kill the backend
:(

=== summary ===
Seems like we have three threads running at the same time and one
thread managed to make another thread shared pointer NULL.

1) Change Channel (nvr is NULL .. causing core dump)
2) Teardown Recorder
3) Stop Live TV

I'll get the latest cvs version and then rebuild programs and try my
scripts again.
Thanks

Mudit

==== detailed logs start here =====



Frontend last log -- after that programe exited due to Ctrl-C
=====
REQUEST->req: 'QUERY_RECORDER 1[]:[]GET_PROGRAM_INFO'
====

Backend Crash
======
#0  0xb7cfd9b2 in TVRec::ChangeChannel (this=0xb636d008, channeldirection=0)
    at tv_rec.cpp:1847
1847        nvr->ChannelNameChanged(channel->GetCurrentName());

(gdb) p nvr
$3 = (class RecorderBase *) 0x0

Seems like nvr is NULL because the frontend exited without closing the
connection.
I think some null pointer checking should be done as multiple threads
are running, and one thread can close the connection while another
thread is trying to change the channel or something ? Application
can't assume the client will always exit gracefully.

where
=====
#0  0xb7cfd9b2 in TVRec::ChangeChannel (this=0xb636d008, channeldirection=0)
    at tv_rec.cpp:1847
#1  0x080617dc in EncoderLink::ChangeChannel (this=0x81015a0, 
    channeldirection=0) at encoderlink.cpp:463
#2  0x08089fdf in MainServer::HandleRecorderQuery (this=0x8105a30, 
    slist=@0xb0b6ca50, commands=@0xb0b6ca30, pbs=0x81022b0)
    at mainserver.cpp:2286
#3  0x080743a8 in MainServer::ProcessRequestWork (this=0x8105a30, 
    sock=0x80f9ae8) at mainserver.cpp:350
#4  0x08072f28 in MainServer::ProcessRequest (this=0x8105a30, sock=0x80f9ae8)
    at mainserver.cpp:202
#5  0x0809c448 in ProcessRequestThread::run (this=0x8105fd0)
    at mainserver.cpp:74
#6  0xb6bc24ea in QThreadInstance::start () from /usr/lib/libqt-mt.so.3
#7  0xb68d4b63 in start_thread () from /lib/tls/libpthread.so.0
#8  0xb678d18a in clone () from /lib/tls/libc.so.6
=====

The other interesting thread running has this stack .. seems like its
tearing down the recorder.

=============
Thread 4 (Thread -1254700112 (LWP 11541)):
#0  0xb68d9436 in __lll_mutex_lock_wait () from /lib/tls/libpthread.so.0
No symbol table info available.
#1  0xb68d6893 in _L_mutex_lock_26 () from /lib/tls/libpthread.so.0
No symbol table info available.
#2  0x080fc148 in ?? ()
No symbol table info available.
#3  0xb536cdfc in ?? ()
No symbol table info available.
#4  0xb536c4c8 in ?? ()
No symbol table info available.
#5  0xb6be0b11 in QEvent::~QEvent () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#6  0xb6ec7322 in QRealMutexPrivate::lock () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#7  0xb6ec7be4 in QMutex::lock () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#8  0xb7cf46b6 in TVRec::TeardownRecorder (this=0xb636d008, killFile=true)
    at tv_rec.cpp:769
        blank_frame_map = {sh = 0x8105430}
        oldProfileName = {static null = {
    static null = <same as static member of an already seen type>, 
    d = 0x80d5070, static shared_null = 0x80d5070}, d = 0x80f9c90, 
  static shared_null = 0x80d5070}
        filelen = 0
#9  0xb7cf35c6 in TVRec::HandleStateChange (this=0xb636d008) at tv_rec.cpp:638
        tmpInternalState = kState_None
        changed = true
        startRecorder = false
        closeRecorder = true
        killRecordingFile = true
        statename = {static null = {
    static null = <same as static member of an already seen type>, 
    d = 0x80d5070, static shared_null = 0x80d5070}, d = 0x81020f0, 
  static shared_null = 0x80d5070}
        origname = {static null = {
    static null = <same as static member of an already seen type>, 
    d = 0x80d5070, static shared_null = 0x80d5070}, d = 0x8106cd8, 
  static shared_null = 0x80d5070}
#10 0xb7cf54d0 in TVRec::RunTV (this=0xb636d008) at tv_rec.cpp:916
No locals.
#11 0xb7cf5471 in TVRec::EventThread (param=0xb636d008) at tv_rec.cpp:900
        thetv = (TVRec *) 0xb636d008
#12 0xb68d4b63 in start_thread () from /lib/tls/libpthread.so.0
No symbol table info available.
#13 0xb678d18a in clone () from /lib/tls/libc.so.6
No symbol table info available.

========== another thread Stop Live TV =========
Thread 1 (Thread -1235786048 (LWP 11529)):
#0  0xb675e99c in nanosleep () from /lib/tls/libc.so.6
No symbol table info available.
#1  0xb678728a in usleep () from /lib/tls/libc.so.6
No symbol table info available.
#2  0xb7cfd7a2 in TVRec::StopLiveTV (this=0xb636d008) at tv_rec.cpp:1787
No locals.
#3  0x080616fd in EncoderLink::StopLiveTV (this=0x81015a0)
    at encoderlink.cpp:419
No locals.
#4  0x080903ea in MainServer::endConnection (this=0x8105a30, socket=0x80f9858)
    at mainserver.cpp:2910
        enc = (EncoderLink *) 0x81015a0
        i = {node = 0x81075c8}
        sock = (struct QSocket *) 0x80f9858
        it = {<std::iterator<std::random_access_iterator_tag,
PlaybackSock*, int, PlaybackSock**, PlaybackSock*&>> = {<No data
fields>},
  _M_current = 0x80ed9c0}
        ft = {<std::iterator<std::random_access_iterator_tag,
FileTransfer*, int, FileTransfer**, FileTransfer*&>> = {<No data
fields>}, _M_current = 0x0}
        rt = {<std::iterator<std::random_access_iterator_tag,
QSocket*, int, QSocket**, QSocket*&>> = {<No data fields>}, _M_current
= 0x80ed230}
#5  0x080b8c5f in MainServer::qt_invoke (this=0x8105a30, _id=5, _o=0xbfffe060)
    at moc_mainserver.cpp:99
No locals.
#6  0xb6c2b71c in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#7  0x080b917e in MythServer::endConnect (this=0x8105858, t0=0x80f9858)
    at moc_server.cpp:117
        clist = (struct QConnectionList *) 0x8106608
        o = {{type = 0x80d2df8, payload = {b = 64, c = 64 '@', s = 30784, 
      i = -1233225664, l = -1233225664, uc = 64 '@', us = 30784, 
      ui = 3061741632, ul = 3061741632, f = -3.79189441e-06, 
      d = 8.1444645091578157e-270, byte = "@x~5\021\b\210mr", 
      bytearray = {data = 0xb67e7840 "", size = 135345648}, ptr = 0xb67e7840, 
      voidstar = {ptr = 0xb67e7840, owner = 240}, charstar = {
        ptr = 0xb67e7840 "", owner = 240}, utf8 = {ptr = 0xb67e7840 "", 
        owner = 240}, local8bit = {ptr = 0xb67e7840 "", owner = 240}, 
      iface = 0xb67e7840, idisp = 0xb67e7840}}, {type = 0x80d2dac, payload = {
      b = 88, c = 88 'X', s = -26536, i = 135239768, l = 135239768, 
      uc = 88 'X', us = 39000, ui = 135239768, ul = 135239768, 
      f = 4.32115764e-34, d = -6.5232833580063458e-45, 
      byte = "X\230\017\b\236¶Y\020\bX\230\017\b", bytearray = {
        data = 0x80f9858 "H\v\b\"\020\b", size = 3066207973}, 
      ptr = 0x80f9858, voidstar = {ptr = 0x80f9858, owner = 229}, charstar = {
        ptr = 0x80f9858 "H\v\b\"\020\b", owner = 229}, utf8 = {
        ptr = 0x80f9858 "H\v\b\"\020\b", owner = 229}, local8bit = {
        ptr = 0x80f9858 "H\v\b\"\020\b", owner = 229}, iface = 0x80f9858, 
      idisp = 0x80f9858}}}
#8  0x080b64d4 in MythServer::discardClient (this=0x8105858) at server.cpp:32
        socket = (RefSocket *) 0x80f9858
#9  0x080b921f in MythServer::qt_invoke (this=0x8105858, _id=3, _o=0xbfffe160)
    at moc_server.cpp:123
No locals.
#10 0xb6c2b71c in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#11 0xb6c2b544 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#12 0xb6f9a01e in QSocket::connectionClosed () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#13 0xb6e28572 in QSocket::sn_read () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#14 0xb6f9a183 in QSocket::qt_invoke () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#15 0xb6c2b71c in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#16 0xb6c2b87d in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#17 0xb6f6b452 in QSocketNotifier::activated () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#18 0xb6c47f00 in QSocketNotifier::event () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#19 0xb6bcee1f in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#20 0xb6bce41e in QApplication::notify () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#21 0xb6bbe81a in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/libqt-mt.so.3
No symbol table info available.
#22 0xb6b77cb3 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#23 0xb6be11d8 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#24 0xb6be1088 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#25 0xb6bcf071 in QApplication::exec () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#26 0x08070a2e in main (argc=1, argv=0xbffffc44) at main.cpp:587
        a = <incomplete type>
        logfile = {static null = {
    static null = <same as static member of an already seen type>, 
    d = 0x80d5070, static shared_null = 0x80d5070}, d = 0x80e8958, 
  static shared_null = 0x80d5070}
        binname = {static null = {
    static null = <same as static member of an already seen type>, 
    d = 0x80d5070, static shared_null = 0x80d5070}, d = 0x80e8990, 
  static shared_null = 0x80d5070}
        verboseString = {static null = {
    static null = <same as static member of an already seen type>, 
    d = 0x80d5070, static shared_null = 0x80d5070}, d = 0x80e89d0, 
static shared_null = 0x80d5070}
        daemonize = false
        printsched = false
        testsched = false
        resched = false
        nosched = false
        printexpire = false
        logfd = -1
        pidfs = <incomplete type>
        port = 6543
        statusport = 6544
        myip = {static null = {
    static null = <same as static member of an already seen type>, 
    d = 0x80d5070, static shared_null = 0x80d5070}, d = 0x80f4c50, 
  static shared_null = 0x80d5070}
        masterip = {static null = {
    static null = <same as static member of an already seen type>, 
    d = 0x80d5070, static shared_null = 0x80d5070}, d = 0x80f4ce8, 
  static shared_null = 0x80d5070}
        ismaster = true
        runsched = true
0xb7cfd9b2      1847        nvr->ChannelNameChanged(channel->GetCurrentName());


More information about the mythtv-dev mailing list