Opened 13 years ago

Closed 13 years ago

#10616 closed Bug Report - Crash (Fixed)

mythtranscode segfaults if called with --fifoinfo

Reported by: furti@… Owned by: beirdo
Priority: minor Milestone: 0.26
Component: MythTV - Mythtranscode Version: 0.25-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description (last modified by beirdo)

please find the full backtrace attached.

/opt/dvb/mythtv/mythtv# gdb -c /var/crash/core_mythtranscode.14020 -se `which mythtranscode`
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /usr/local/bin/mythtranscode...done.
[New LWP 14020]
[New LWP 14028]
[New LWP 14033]
[New LWP 14034]
[New LWP 14031]
[New LWP 14032]
[New LWP 14022]
[New LWP 14026]
[New LWP 14021]

warning: Can't read pathname for load map: Input/output error.
[Thread debugging using libthread_db enabled]
Core was generated by `mythtranscode --fifoinfo --profile autodetect --chanid 29724 --starttime 200812'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f0a7ae760aa in PlayerContext::StopPlaying (this=0x23d6a20) at playercontext.cpp:483
483         player->StopPlaying();
(gdb) 


/opt/dvb/mythtv/mythtv# mythtranscode --version
Please attach all output as a file in bug reports.
MythTV Version : v0.25-23-g00a2d87
MythTV Branch : fixes/0.25
Network Protocol : 72
Library API : 0.25.20120408-1
QT Version : 4.7.4
Options compiled in:
 linux debug use_hidesyms using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_php using_dvb using_frontend using_hdhomerun using_ceton using_hdpvr using_iptv using_ivtv using_joystick_menu using_libcrypto using_lirc using_mheg using_opengl_video using_qtwebkit using_qtscript using_qtdbus using_v4l2 using_x11 using_xv using_bindings_perl using_bindings_php using_mythtranscode using_opengl using_vdpau using_ffmpeg_threads using_live using_mheg

Attachments (2)

backtrace.txt (6.8 KB) - added by furti@… 13 years ago.
10616-v1.patch (20.9 KB) - added by danielk 13 years ago.
Attempt at better fix.

Download all attachments as: .zip

Change History (14)

Changed 13 years ago by furti@…

Attachment: backtrace.txt added

comment:1 Changed 13 years ago by beirdo

Owner: set to beirdo
Status: newassigned

comment:2 Changed 13 years ago by beirdo

Description: modified (diff)

comment:3 Changed 13 years ago by furti@…

I tried to dig further, this prevents segfaulting ... a small next step

diff --git a/mythtv/programs/mythtranscode/main.cpp b/mythtv/programs/mythtranscode/main.cpp
index 8036dfd..2287d88 100644
--- a/mythtv/programs/mythtranscode/main.cpp
+++ b/mythtv/programs/mythtranscode/main.cpp
@@ -596,7 +596,7 @@ int main(int argc, char *argv[])
 
     if (fifo_info)
     {
-        delete transcode;
+//        delete transcode;
         return GENERIC_EXIT_OK;
     }

comment:4 Changed 13 years ago by beirdo

Turns out that we have far too many things freeing player_ctx in the code that runs before that. I could either put in "player_ctx = NULL;" after each delete, or do it the simpler way. I went for the simpler way.

comment:5 Changed 13 years ago by Gavin Hurlbut <ghurlbut@…>

Resolution: fixed
Status: assignedclosed

In c5a9262355a51b2d2b0465234d79b527c3907e84/mythtv:

Convert the use of player_ctx in mythtranscode to QPointer<>

We have far too many places in the transcode code path that delete player_ctx
and return. Unfortunately, freeing "transcode" also will try to delee
player_ctx, but it's already deleted, and not nulled out. Rather than putting
many instances of "player_ctx = NULL", I opted to make PlayerContext? a
QObject, and then just use QPointer<PlayerContext?> as this will clear itself
to NULL as soon as it is destroyed.

Fixes #10616

comment:6 Changed 13 years ago by beirdo

Milestone: unknown0.26

comment:7 Changed 13 years ago by beirdo

Milestone: 0.260.25.1

comment:8 Changed 13 years ago by Gavin Hurlbut <ghurlbut@…>

In 9cb904e9b9998ea94eadba4db54c0af10dc893f0/mythtv:

Convert the use of player_ctx in mythtranscode to QPointer<>

We have far too many places in the transcode code path that delete player_ctx
and return. Unfortunately, freeing "transcode" also will try to delee
player_ctx, but it's already deleted, and not nulled out. Rather than putting
many instances of "player_ctx = NULL", I opted to make PlayerContext? a
QObject, and then just use QPointer<PlayerContext?> as this will clear itself
to NULL as soon as it is destroyed.

Fixes #10616
(cherry picked from commit c5a9262355a51b2d2b0465234d79b527c3907e84)

Changed 13 years ago by danielk

Attachment: 10616-v1.patch added

Attempt at better fix.

comment:9 Changed 13 years ago by danielk

Resolution: fixed
Status: closednew

Gavin, when I saw the QPointer<> fix I suspected there was a deeper problem here and there is. A PlayerContext? takes ownership of the MythPlayer? and input RingBuffer?, but we're keeping pointers to them in Transcode which become invalid as soon as the PlayerContext? is deleted. I've attached a patch which both manages the PlayerContext? pointer and makes sure we don't keep any pointers to delete MythPlayer? and RingBuffer? instances around.

I haven't tested this patch at all. If you would like me to take ownership of this ticket let me know, otherwise I'm pretty sure you can use this as is.

comment:10 Changed 13 years ago by beirdo

That does look workable. I'll look at incorporating it tonight.

comment:11 Changed 13 years ago by Daniel Kristjansson <danielk@…>

In 4a3581db9acf059142143426caf46e91cbe96153/mythtv:

Rework ownership of RingBuffer? and MythPlayer? in transcode

Refs #10616

Signed-off-by: Gavin Hurlbut <ghurlbut@…>

comment:12 Changed 13 years ago by beirdo

Milestone: 0.25.10.26
Resolution: Fixed
Status: newclosed

Having heard no follow-up problems with Daniel's rework, I'm closing this.

Note: See TracTickets for help on using tickets.