Opened 10 years ago

Closed 10 years ago

#6736 closed defect (fixed)

strange mythtv segfaults

Reported by: markus.doits@… Owned by: Janne Grunau
Priority: major Milestone: unknown
Component: MythTV - Mythtranscode Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

using svn rev 20947.

so first running simply ./configure:

# Basic Settings
Compile type              release
Compiler cache            symlink gcc
DistCC                    no
qmake                     /usr/bin/qmake-qt4
install prefix            /usr/local
runtime prefix            /usr/local
CPU                       x86 x86_64 (model name        : Intel(R) Core(TM)2 Quad  CPU   Q9300  @ 2.50GHz)
big-endian                no
runtime cpu detection     no
yasm                      yes
MMX enabled               yes
MMX2 enabled              yes
3DNow! enabled            yes
3DNow! extended enabled   yes
SSE enabled               yes
SSSE3 enabled             yes
CMOV enabled              yes
CMOV is fast              yes

# Input Support
Joystick menu             yes
lirc support              yes
Video4Linux sup.          yes
ivtv support              yes
HR-PVR support            yes
FireWire support          yes
DVB support               yes [/usr/include]
HDHomeRun support         yes
IPTV support              yes

# Sound Output Support
PulseAudio support        yes
OSS support               yes
ALSA support              yes
aRts support              yes
JACK support              yes
libfftw3 support          no

# Video Output Support
x11 support               yes
xrandr support            yes
xv support                yes
XvMC support              yes
XvMC VLD support          yes
XvMC pro support          no
XvMC libs                 -lXvMCW
VDPAU support             yes
OpenGL video              yes
OpenGL vsync              yes
DirectFB                  yes
Fribidi formatting        no
MHEG support              yes

# Misc Features
multi threaded libavcodec yes
Frontend                  yes
Backend                   yes

# Bindings
bindings_perl             yes
bindings_python           yes

it builds fine. but here, using mythtranscode gives the following (i removed various "no debugging symbols found"-lines):

(gdb) run -i 1014_20090718134400.mpg -o /tmp/bla -p autodetect --showprogress
(no debugging symbols found)
Starting program: /usr/local/bin/mythtranscode -i 1014_20090718134400.mpg -o /tmp/bla -p autodetect --showprogress
(no debugging symbols found)
...
009-07-18 14:19:05.855 Using runtime prefix = /usr/local
2009-07-18 14:19:05.855 Empty LocalHostName.
[New Thread 0x7febfa056950 (LWP 9340)]
[Thread 0x7febfa056950 (LWP 9340) exited]
2009-07-18 14:19:05.881 New DB connection, total: 1
2009-07-18 14:19:05.884 Closing DB connection named 'DBManager0'
2009-07-18 14:19:05.884 Enabled verbose msgs: important
2009-07-18 14:19:05.886 New DB connection, total: 2
2009-07-18 14:19:05.891 New DB connection, total: 3
2009-07-18 14:19:06.531 Using protocol version 45
[New Thread 0x7febfa056950 (LWP 9341)]
[New Thread 0x7febf7824950 (LWP 9342)]
[New Thread 0x7febf7023950 (LWP 9343)]
[New Thread 0x7febf6822950 (LWP 9344)]
[New Thread 0x7febf6019950 (LWP 9345)]
2009-07-18 14:19:06.704 Transcode: Looking for autodetect profile: Autodetect from 576i
2009-07-18 14:19:06.719 Transcode: Using autodetect profile: MPEG2
[New Thread 0x7febf5607950 (LWP 9346)]
[New Thread 0x7febf4dfe950 (LWP 9347)]
strange error flushing buffer ...
2009-07-18 14:19:06.780 mythtranscode: 0% Completed @ 0 fps.
2009-07-18 14:19:10.902 Processed: 219 of 1925 frames(8 seconds)
2009-07-18 14:19:15.904 Processed: 513 of 1925 frames(20 seconds)
2009-07-18 14:19:20.914 Processed: 832 of 1925 frames(33 seconds)
2009-07-18 14:19:25.915 Processed: 1143 of 1925 frames(45 seconds)
2009-07-18 14:19:26.789 mythtranscode: 62% Completed @ 60.004 fps.
2009-07-18 14:19:30.916 Processed: 1461 of 1925 frames(58 seconds)
2009-07-18 14:19:35.933 Processed: 1793 of 1925 frames(71 seconds)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fec0afd77a0 (LWP 9339)]
0x00007fec08ef6b90 in sws_freeContext () from /usr/local/lib/libmythswscale-0.22.so.0
(gdb) bt
#0  0x00007fec08ef6b90 in sws_freeContext () from /usr/local/lib/libmythswscale-0.22.so.0
#1  0x00000000004204cd in ?? ()
#2  0x0000000000414e61 in ?? ()
#3  0x00007fec027425a6 in __libc_start_main () from /lib/libc.so.6
#4  0x0000000000409949 in ?? ()
#5  0x00007fff65dda098 in ?? ()
#6  0x000000000000001c in ?? ()
#7  0x0000000000000008 in ?? ()
#8  0x00007fff65ddb073 in ?? ()
#9  0x00007fff65ddb090 in ?? ()
#10 0x00007fff65ddb093 in ?? ()
#11 0x00007fff65ddb0ab in ?? ()
#12 0x00007fff65ddb0ae in ?? ()
#13 0x00007fff65ddb0b7 in ?? ()
#14 0x00007fff65ddb0ba in ?? ()
#15 0x00007fff65ddb0c5 in ?? ()
#16 0x0000000000000000 in ?? ()

okey, so now i want to debug it, therefore: ./configure --compile-type=debug

builds fine, but now see mythtranscode (nothing removed from output):

(gdb) run -i 1014_20090718134400.mpg -o /tmp/bla -p autodetect --showprogress
The program being debugged has been started already.
Start it from the beginning? (y or n) y
`/usr/local/bin/mythtranscode' has changed; re-reading symbols.
Starting program: /usr/local/bin/mythtranscode -i 1014_20090718134400.mpg -o /tmp/bla -p autodetect --showprogress
[Thread debugging using libthread_db enabled]
[New Thread 0x7f936cbed7a0 (LWP 18012)]
2009-07-18 14:27:49.013 Using runtime prefix = /usr/local
2009-07-18 14:27:49.013 Empty LocalHostName.
[New Thread 0x7f935b969950 (LWP 18013)]
[Thread 0x7f935b969950 (LWP 18013) exited]
2009-07-18 14:27:49.041 New DB connection, total: 1
2009-07-18 14:27:49.044 Closing DB connection named 'DBManager0'
2009-07-18 14:27:49.044 Enabled verbose msgs: important
2009-07-18 14:27:49.046 New DB connection, total: 2
2009-07-18 14:27:49.047 New DB connection, total: 3
2009-07-18 14:27:49.136 Using protocol version 45
[New Thread 0x7f935b969950 (LWP 18014)]
[New Thread 0x7f9359137950 (LWP 18015)]
[New Thread 0x7f9358936950 (LWP 18016)]
[New Thread 0x7f9358135950 (LWP 18017)]
[New Thread 0x7f935792c950 (LWP 18018)]
2009-07-18 14:27:49.349 Transcode: Looking for autodetect profile: Autodetect from 576i
2009-07-18 14:27:49.376 Transcode: Using autodetect profile: MPEG2
[New Thread 0x7f9356f1a950 (LWP 18019)]
[New Thread 0x7f9356711950 (LWP 18020)]
strange error flushing buffer ...
2009-07-18 14:27:49.449 mythtranscode: 0% Completed @ 0 fps.
2009-07-18 14:27:54.065 Processed: 247 of 1925 frames(9 seconds)
2009-07-18 14:27:59.071 Processed: 548 of 1925 frames(21 seconds)
2009-07-18 14:28:04.075 Processed: 873 of 1925 frames(34 seconds)
2009-07-18 14:28:09.081 Processed: 1185 of 1925 frames(47 seconds)
2009-07-18 14:28:09.462 mythtranscode: 62% Completed @ 60.2794 fps.
2009-07-18 14:28:14.090 Processed: 1491 of 1925 frames(59 seconds)
2009-07-18 14:28:19.106 Processed: 1814 of 1925 frames(72 seconds)
[Thread 0x7f935792c950 (LWP 18018) exited]
[Thread 0x7f9358135950 (LWP 18017) exited]
[Thread 0x7f9359137950 (LWP 18015) exited]
[Thread 0x7f9358936950 (LWP 18016) exited]
[Thread 0x7f935b969950 (LWP 18014) exited]

Program exited normally.

looks fine. so enabling debug mode seems to fix mythtranscode segfault.

but the problem remains running mythtranscode from within mythtv, e.g. mythweb. i click on "transcode" at the recording and logs say:

0  	15126  	transcode  	5  	0  	2009-07-18 14:30:41  	eltarun  	Transcode Errored  	Sportschau live "DTM Qualifying / Formel 3 Euroserie": Autodetect (exit status 0, job status was "Running")
1 	15125 	transcode 	5 	0 	2009-07-18 14:30:09 	eltarun 	Transcode Starting 	Sportschau live "DTM Qualifying / Formel 3 Euroserie": Autodetect (47.6 MB)

and "dmesg" shows:

[ 6729.185090] mythtranscode[18311] general protection ip:7f967becdc05 sp:7fff028ea340 error:0 in libc-2.9.so[7f967be5a000+149000]

switching back now to compile-type=release and trying to transcode from within mythttv gives dmesg-output:

[ 7064.605586] mythtranscode[26766]: segfault at 883 ip 00007f1fb1672b90 sp 00007fff2544b750 error 4 in libmythswscale-0.22.so.0.22.0[7f1fb1650000+3b000]

but this doesn't come up when using gdb.

after clicking around trying to transcode various other recordings i now also got (compile-type=release)

[ 7524.682222] mythtranscode[3725] general protection ip:7ff7cdb3f344 sp:7fff6e1b9d50 error:0 in libmythavutil-0.22.so.0.22.0[7ff7cdb38000+c000]

what's going on? is my system (debian squeeze/sid) broken or mythtv? how can i debug this further?

thanks for your help

Attachments (1)

gdb.txt (14.0 KB) - added by markus.doits@… 10 years ago.
compile-type=profile

Download all attachments as: .zip

Change History (10)

comment:1 Changed 10 years ago by laga

Status: newinfoneeded_new

Can you please try a profile build and then get a backtrace?

comment:2 Changed 10 years ago by anonymous

all right, here it comes (looks like good debug-output now):

(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
`/usr/local/bin/mythtranscode' has changed; re-reading symbols.
Starting program: /usr/local/bin/mythtranscode -i 1014_20090718134400.mpg -o /tmp/bla -p autodetect --showprogress
[Thread debugging using libthread_db enabled]
[New Thread 0x7f5bd29617a0 (LWP 16825)]
2009-07-18 15:54:26.679 Using runtime prefix = /usr/local
2009-07-18 15:54:26.679 Empty LocalHostName.
[New Thread 0x7f5bc1999950 (LWP 16826)]
[Thread 0x7f5bc1999950 (LWP 16826) exited]
2009-07-18 15:54:26.724 New DB connection, total: 1
2009-07-18 15:54:26.732 Closing DB connection named 'DBManager0'
2009-07-18 15:54:26.732 Enabled verbose msgs: important
2009-07-18 15:54:26.734 New DB connection, total: 2
2009-07-18 15:54:26.735 New DB connection, total: 3
2009-07-18 15:54:26.832 Using protocol version 45
[New Thread 0x7f5bc1999950 (LWP 16827)]
[New Thread 0x7f5bbf167950 (LWP 16828)]
[New Thread 0x7f5bbe966950 (LWP 16829)]
[New Thread 0x7f5bbe165950 (LWP 16830)]
[New Thread 0x7f5bbd964950 (LWP 16831)]
2009-07-18 15:54:26.986 Transcode: Looking for autodetect profile: Autodetect from 576i
2009-07-18 15:54:27.004 Transcode: Using autodetect profile: MPEG2
[New Thread 0x7f5bbcf52950 (LWP 16832)]
[New Thread 0x7f5bbc749950 (LWP 16833)]
strange error flushing buffer ...
2009-07-18 15:54:27.068 mythtranscode: 0% Completed @ 0 fps.
2009-07-18 15:54:31.760 Processed: 242 of 1925 frames(9 seconds)
2009-07-18 15:54:36.773 Processed: 527 of 1925 frames(21 seconds)
2009-07-18 15:54:41.786 Processed: 836 of 1925 frames(33 seconds)
2009-07-18 15:54:46.798 Processed: 1139 of 1925 frames(45 seconds)
2009-07-18 15:54:47.074 mythtranscode: 60% Completed @ 57.7576 fps.
2009-07-18 15:54:51.814 Processed: 1436 of 1925 frames(57 seconds)
2009-07-18 15:54:56.829 Processed: 1754 of 1925 frames(70 seconds)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f5bd29617a0 (LWP 16825)]
0x00007f5bd084fb90 in sws_freeContext () from /usr/local/lib/libmythswscale-0.22.so.0
Current language:  auto; currently asm
(gdb) bt
#0  0x00007f5bd084fb90 in sws_freeContext () from /usr/local/lib/libmythswscale-0.22.so.0
#1  0x000000000042096f in Transcode::TranscodeFile (this=0x156ea30, inputname=<value optimized out>, outputname=<value optimized out>,
    profileName=<value optimized out>, honorCutList=<value optimized out>, framecontrol=<value optimized out>, jobID=-1, fifodir=
      {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 315}, alloc = 0, size = 0, data = 0x6594da, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 156}, alloc = 0, size = 0, data = 0x7f5bcafb1ada, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x6594c0, static codecForCStrings = 0x0},
    deleteMap={{d = 0x6594e0, e = 0x6594e0}}) at transcode.cpp:1162
#2  0x00000000004152cd in main (argc=8, argv=<value optimized out>) at main.cpp:591

comment:3 Changed 10 years ago by Dibblah

Please follow the instructions at: http://www.mythtv.org/docs/mythtv-HOWTO-22.html#ss22.2

to get a full backtrace.

Changed 10 years ago by markus.doits@…

Attachment: gdb.txt added

compile-type=profile

comment:4 Changed 10 years ago by markus.doits@…

okey, attached. it's build-type=profile though, since debug does not get the segfault.

comment:5 Changed 10 years ago by anonymous

Looks like a simple case of an uninitialized variable. Change line 808 of transcode.cpp from:

    struct SwsContext  *scontext;

to

    struct SwsContext  *scontext = NULL;

comment:6 Changed 10 years ago by markus.doits@…

thanks, that did the trick! working flawlessly now.

comment:7 Changed 10 years ago by Janne Grunau

Status: infoneeded_newnew

comment:8 Changed 10 years ago by Janne Grunau

Owner: changed from Isaac Richards to Janne Grunau
Status: newaccepted

comment:9 Changed 10 years ago by Janne Grunau

Resolution: fixed
Status: acceptedclosed

(In [20949]) initialize swscontext in mythtranscode to NULL to avoid segfault on free, Fixes #6736

Note: See TracTickets for help on using tickets.