Opened 2 years ago

Closed 8 months ago

#12773 closed Bug Report - Crash (Won't Fix)

backend segfault LiveTV HTTPTS

Reported by: charles.bovy@… Owned by:
Priority: minor Milestone: 0.28.2
Component: MythTV - General Version: 0.28.0
Severity: medium Keywords:
Cc: Ticket locked: no

Description (last modified by dekarl)

The backend segfaults while starting LiveTV on a HTTPTS channel occasionally (not always).

I'm using 2:0.28.0+fixes.20160512.370dd71-0ubuntu0mythbuntu2

I've been using fixes/0.27 before, where I haven't seen it happen.

Part of backend log:

May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: I TVRecEvent tv_rec.cpp:1073 (HandleStateChange) TVRec[29]: Changing from None to WatchingLiveTV
May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: I TVRecEvent tv_rec.cpp:3685 (TuningFrequency) TVRec[29]: TuningFrequency
May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: I TVRecEvent recorders/httptsstreamhandler.cpp:93 (HTTPTSStreamHandler) HTTPTSSH(http://localhost:5555/iptv/224.0.251.124/8248): ctor
May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: C CoreContext signalhandling.cpp:305 (handleSignal) Received Segmentation fault: Code 1, PID 96, UID 0, Value 0x7f3b28000020
May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: I TVRecEvent mythsingledownload.cpp:119 (Progress) MythSingleDownload: Reached specified max file size (10000 bytes)
May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: I TVRecEvent mythsingledownload.cpp:110 (Cancel) MythSingleDownload: Aborting download
May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: I TVRecEvent channelutil.cpp:1976 (GetIPTVTuningData) Loaded [data]http://localhost:5555/iptv/224.0.251.124/8248[fectype][fec0][fec1] for 11001
May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: N CoreContext autoexpire.cpp:264 (CalcParams) AutoExpire: CalcParams(): Max required Free Space: 3.0 GB w/freq: 14 min
May 14 21:01:18 biohazard mythbackend: mythbackend[12725]: N TVRecEvent recordinginfo.cpp:687 (ApplyRecordRecGroupChange) ApplyRecordRecGroupChange: LiveTV to LiveTV (2)

Stacktrace attached.

Attachments (3)

gdb.txt (87.1 KB) - added by charles.bovy@… 2 years ago.
1st-run.log (56.5 KB) - added by charles.bovy@… 2 years ago.
1st run Watch Live TV
2nd-run.log (14.0 KB) - added by charles.bovy@… 2 years ago.
2nd run Watch Live TV

Download all attachments as: .zip

Change History (17)

Changed 2 years ago by charles.bovy@…

Attachment: gdb.txt added

comment:1 Changed 2 years ago by dekarl

Description: modified (diff)

added wiki formatting

comment:2 Changed 2 years ago by charles.bovy@…

After some investigation, it seems that it is reproducable. The first time Live TV it functions correctly, but the second time (after exit), it segfaults. I'll attache two log files with of the first time Watch TV and second time Watch TV. Different

Changed 2 years ago by charles.bovy@…

Attachment: 1st-run.log added

1st run Watch Live TV

Changed 2 years ago by charles.bovy@…

Attachment: 2nd-run.log added

2nd run Watch Live TV

comment:3 Changed 2 years ago by Stuart Auchterlonie

Milestone: unknown0.28.1
Version: 0.28.0

comment:4 Changed 2 years ago by paulh

I've had a couple of goes trying to reproduce this without success. It works perfectly every time for me.

The BT is missing the part telling us which thread crashed but I would guess it was either thread 1 or 47 and the problem is caused by iterating over the StreamDataList? QMap which has somehow become out of date. Probably being modified by 2 threads at the same time but I don't see where after a quick look at the code.

comment:5 Changed 2 years ago by Stuart Auchterlonie

I have the same suspicion as Paul, that the StreamDataList? is being modified whilst it's being iterate over. I too have not yet been able to identify where this might be happening.

comment:6 Changed 2 years ago by and.mayer@…

I'm able to reproduce here, it happens to me (on fixes/0.28) each time I change to an iptv channel for the second time (by exiting from LiveTV or by changing to a dvb-s channel and comming back to a iptv channel), when changing to another iptv channel while still on the same iptv recorder it does NOT SEGV. In my opinion there is something left over when closing the iptv recorder which leads to the SEGV when trying to access the pointer to mpeg stream data (not the list) which is not vaild anymore.

comment:7 Changed 2 years ago by charles.bovy@…

Thanks for your message. Can you try the patch of https://code.mythtv.org/trac/ticket/12856#comment:11 ?

comment:8 Changed 2 years ago by and.mayer@…

Applied the patch from ticket 12856, no backend segfaults anymore. Thank you!

comment:9 Changed 2 years ago by and.mayer@…

Sorry, I was wrong, still segfaults on the same line at HTTPReader::WriteBytes? sometimes when changing to iptv channels, but this time I was not able to find a pattern until now.

comment:10 Changed 2 years ago by and.mayer@…

After applying attached patch (in addition to the patch from ticket 12856) BE did not segfault for the last week.

--- a/mythtv/libs/libmythtv/recorders/iptvchannel.cpp
+++ b/mythtv/libs/libmythtv/recorders/iptvchannel.cpp
@@ -122,8 +122,14 @@ void IPTVChannel::CloseStreamHandler(void)

     if (m_stream_handler)
     {
-        if (m_stream_data)
+        if (m_stream_data) {
             m_stream_handler->RemoveListener(m_stream_data);
+            m_stream_data = NULL;
+        }

         HLSStreamHandler* hsh = dynamic_cast<HLSStreamHandler*>(m_stream_handler);
         HTTPTSStreamHandler* httpsh = dynamic_cast<HTTPTSStreamHandler*>(m_stream_handler);

comment:11 Changed 22 months ago by mike.bibbings@…

Since adding the above patch (m_stream_data = NULL) a few weeks ago I have not had any more seg faults using my VBOX in multirec mode (see https://forum.mythtv.org/viewtopic.php?f=9&t=1724 )

comment:12 Changed 20 months ago by Stuart Auchterlonie

Milestone: 0.28.10.28.2

Moving remaining open 0.28.1 tickets to 0.28.2

comment:13 Changed 18 months ago by perkins1724@…

I have just applied the patch from comment:10 and it appears it may also resolve my segfault from this thread - https://lists.gt.net/mythtv/users/605013.

Just to note that this patch is currently in master as it was bundled in with the VBOX multirec changes noted in comment:11. Not clear if the commit is likely to be pushed to fixes/0.28 yet (has not currently been applied to fixes/0.28).

comment:14 Changed 8 months ago by Stuart Auchterlonie

Resolution: Won't Fix
Status: newclosed

Closing any remaining tickets for 0.28, if the issue persists, feel free to reopen and align to v29 or master

Note: See TracTickets for help on using tickets.