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 4 years ago

Closed 4 years ago

#6725 closed defect (fixed)

segmentation fault in mythbackend

Reported by: Simon Kenyon <simon@…> Owned by: danielk
Priority: minor Milestone: 0.22
Component: MythTV - DVB/ATSC Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

for me, mythbackend has been unreliable for a while
i took the time to run it under gdb and have two crash logs
it crashed twice in the same place

i was doing nothing at the time (no recording or live tv)

this time, i don't think it is the dvb-s signal strength/quality or stream errors. but i could be wrong.

i will attach the full logs, but here are the crash sites

the first:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x459fd950 (LWP 28282)]
0x00007f3d6891e97b in QLocalePrivate::numberToCLocale () from /usr/lib/qt4/libQtCore.so.4

Thread 37 (Thread 0x4080d950 (LWP 28367)):
#0 0x00007f3d6737da62 in select () from /lib/libc.so.6
No symbol table info available.
#1 0x00007f3d6fa514d8 in DVBStreamHandler::RunTS (this=0x7f3d580af6d0) at dvbstreamhandler.cpp:339

timeout = {tv_sec = 0, tv_usec = 30000}
ret = 0
len = 0
remainder = 0
buffer_size = 2820000
buffer = (unsigned char *) 0xa5da60 "G"
dvr_dev_path = {static shared_null = {ref = {_q_value = 8}, alloc = 0, size = 0, data = 0x7f3d68c89698 "", array = ""}, static shared_empty = {ref = {_q_value = 2}, alloc = 0, size = 0, data = 0x7f3d68c896b8 "", array = ""}, d = 0xa16b30}
dvr_fd = 42
_error = false
fd_select_set = {fds_bits = {0 <repeats 16 times>}}

#2 0x00007f3d6fa52292 in DVBStreamHandler::Run (this=0x7f3d580af6d0) at dvbstreamhandler.cpp:253
No locals.
#3 0x00007f3d6fa522b3 in run_dvb_stream_handler_thunk (param=0x7f3d580af6d0) at dvbstreamhandler.cpp:194

mon = (DVBStreamHandler *) 0x7f3d580af6d0

#4 0x00007f3d67fa2097 in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#5 0x00007f3d67383ccd in clone () from /lib/libc.so.6
No symbol table info available.
#6 0x0000000000000000 in ?? ()
No symbol table info available.

and the second (6 minutes later):

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x4c581950 (LWP 28442)]
0x00007f181ed9597b in QLocalePrivate::numberToCLocale () from /usr/lib/qt4/libQtCore.so.4

Thread 30 (Thread 0x4e585950 (LWP 28552)):
#0 0x00007f181d7f4a62 in select () from /lib/libc.so.6
No symbol table info available.
#1 0x00007f1825ec84d8 in DVBStreamHandler::RunTS (this=0x7f180c0736a0) at dvbstreamhandler.cpp:339

timeout = {tv_sec = 0, tv_usec = 50000}
ret = 1
len = 0
remainder = 0
buffer_size = 2820000
buffer = (unsigned char *) 0x7f181192a010 "G\t\001\021\205\n<C3>\v\001ɨp\211\021<DE>\224<C1>\212\223T<A4>\bT<CB><E7>\030

<AA>\232<A9>\234<A4>\006g=\035Jd\235H3H\f<B0>\211R2\2203)\003\020<E9>X\235J<A0>"

dvr_dev_path = {static shared_null = {ref = {_q_value = 14}, alloc = 0, size = 0, data = 0x7f181f100698 "", array = ""}, static shared_empty = {ref = {_q_value = 2}, alloc = 0, size = 0, data = 0x7f181f1006b8 "", array = ""}, d = 0x948970}
dvr_fd = 52
_error = false
fd_select_set = {fds_bits = {4503599627370496, 0 <repeats 15 times>}}

#2 0x00007f1825ec9292 in DVBStreamHandler::Run (this=0x7f180c0736a0) at dvbstreamhandler.cpp:253
No locals.
#3 0x00007f1825ec92b3 in run_dvb_stream_handler_thunk (param=0x7f180c0736a0) at dvbstreamhandler.cpp:194

mon = (DVBStreamHandler *) 0x7f180c0736a0

#4 0x00007f181e419097 in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#5 0x00007f181d7faccd in clone () from /lib/libc.so.6
No symbol table info available.
#6 0x0000000000000000 in ?? ()
No symbol table info available.

Attachments (4)

gdb.txt-200907140940.zip (5.7 KB) - added by Simon Kenyon <simon@…> 4 years ago.
gdb.txt-200907140946.zip (8.1 KB) - added by Simon Kenyon <simon@…> 4 years ago.
myth.log-200907140940.zip (26.8 KB) - added by Simon Kenyon <simon@…> 4 years ago.
myth.txt-200907140946.zip (6.9 KB) - added by Simon Kenyon <simon@…> 4 years ago.

Download all attachments as: .zip

Change History (21)

Changed 4 years ago by Simon Kenyon <simon@…>

Changed 4 years ago by Simon Kenyon <simon@…>

Changed 4 years ago by Simon Kenyon <simon@…>

Changed 4 years ago by Simon Kenyon <simon@…>

comment:1 Changed 4 years ago by Dibblah

  • Status changed from new to infoneeded_new

Which branch of Myth, which revision and what patches do you have applied?

comment:2 Changed 4 years ago by Dibblah

This backtrace appears to be caused by the expirer miscalculating the bitrate of your recordings.

maxKBperMin = 139899972187635

Looks to me like it's caused by a corrupt recording.

comment:3 Changed 4 years ago by Simon Kenyon <simon@…>

trunk. no patches.

Path: .
URL: http://cvs.mythtv.org/svn/trunk
Repository Root: http://cvs.mythtv.org/svn
Repository UUID: 7dbf422c-18fa-0310-86e9-fd20926502f2
Revision: 20881
Node Kind: directory
Schedule: normal
Last Changed Author: danielk
Last Changed Rev: 20881
Last Changed Date: 2009-07-13 22:14:33 +0100 (Mon, 13 Jul 2009)

comment:4 Changed 4 years ago by Simon Kenyon <simon@…>

2.6.27-gentoo-r7 x86_64 on an AMD Athlon64 X2 6000+
two DVB-S cards and a PVR-350
master backend

comment:5 Changed 4 years ago by stuarta

  • Status changed from infoneeded_new to new

Any chance you could attach the full backtrace as per
section 22.2 of the howto please?

Stuart

comment:6 Changed 4 years ago by stuarta

  • Status changed from new to infoneeded_new

comment:7 Changed 4 years ago by Simon Kenyon <simon@…>

i *did* that when i submitted the bug report
just scroll up and there they are :-)

comment:8 Changed 4 years ago by stuartm

  • Milestone changed from unknown to 0.22
  • Status changed from infoneeded_new to new

Following patch should prevent the segfault, though I'm not sure whether 'state' should default to false or true if we fail to discover it's true state.

Index: mythtv/programs/mythbackend/playbacksock.cpp
===================================================================
--- mythtv/programs/mythbackend/playbacksock.cpp        (revision 20919)
+++ mythtv/programs/mythbackend/playbacksock.cpp        (working copy)
@@ -289,8 +289,14 @@
                 " gave us no response.");
     }

+    bool state = false;
+
+    if (!strlist.isEmpty())
+    {
     QStringList::const_iterator it = strlist.begin();
-    bool state = (*it).toInt();
+        state = (*it).toInt();
+    }
+
     if (busy_input)
     {
         it++;

comment:9 Changed 4 years ago by Simon Kenyon <simon@…>

not wishing to appear ungrateful...
but did you try compiling that? it doesn't
the variable it is now out of scope in "if (busy_input) {"
will look at the code in playbacksock.cpp and see what you meant

comment:10 Changed 4 years ago by stuartm

  • Status changed from new to infoneeded_new
Index: mythtv/programs/mythbackend/playbacksock.cpp
===================================================================
--- mythtv/programs/mythbackend/playbacksock.cpp        (revision 20919)
+++ mythtv/programs/mythbackend/playbacksock.cpp        (working copy)
@@ -289,8 +289,13 @@
                 " gave us no response.");
     }

+    bool state = false;
+
+    if (!strlist.isEmpty())
+    {
     QStringList::const_iterator it = strlist.begin();
-    bool state = (*it).toInt();
+        state = (*it).toInt();
+
     if (busy_input)
     {
         it++;
@@ -302,6 +307,7 @@
             state = false; // pretend it's not busy if we can't parse response
         }
     }
+    }

     return state;
 }

comment:11 Changed 4 years ago by Simon Kenyon <simon@…>

i looked at the code and pretty much made the same change.

it took a while to install because something has changed in the way that the configure script handles XvMC; which meant that i could not get myth to compile.

it has been running for 12 hours now, with no crashes.

i will put in a log message to see how often this occurs.

comment:12 Changed 4 years ago by Simon Kenyon <simon@…>

in my slave backend log (newyork) i saw this message:

2009-07-17 11:46:37.078 MythSocket(7ff63c1034e0:-1): writeStringList: Error, socket went unconnected.

and in the master backend i saw this:

2009-07-17 11:46:23.280 Slave backend: newyork no longer connected
2009-07-17 11:46:23.285 PlaybackSock::SendReceiveStringList(): No response.
2009-07-17 11:46:23.285 PlaybackSock, Error: IsBusy: QUERY_REMOTEENCODER 56 gave us no response.
2009-07-17 11:46:23.285 PlaybackSock, Error: IsBusy: strlist is empty 56

the last message is the log i added to print when the "if (!strlist.isEmpty())" test failed

comment:13 Changed 4 years ago by stuartm

The slave backends losing connectivity to the master is a known issue that Daniel is investigating, the segfault although related will be treated as a separate issue. If you can confirm that the master backend remains functional and doesn't segfault with the application of the patch?

comment:14 Changed 4 years ago by Simon Kenyon <simon@…>

i'm in the office so cannot run mythfrontend

however, i started a recording with mythweb and can watch the in-flight recording with flowplayer. so it seems to be still working.

there are some regular log messages "strlist is empty" indicating the the "if test" is being triggered. my assumption is that i would have crashed on each occurance without your patch.

comment:15 Changed 4 years ago by stuartm

  • Status changed from infoneeded_new to new

comment:16 Changed 4 years ago by stuartm

(In [21068]) Prevent segfault in mythbackend caused by an invalid response to QUERY_RECORDER from a slave backend. Refs #6725

comment:17 Changed 4 years ago by danielk

  • Resolution set to fixed
  • Status changed from new to closed

The segfault has been fixed, the socket disconnect problem is a separate issue and already has several tickets open. I'll reference #6516 when that is fixed.

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.