[mythtv] Segfault + BT: Race condition in filtermanager

Ed Wildgoose lists at wildgooses.com
Fri Jun 25 06:36:26 EDT 2004


I'm still trying to track down the segfault that I repeatedly see when 
video changes aspect ratio from 4:3 to 16:9.  At last with the latest 
GDB I seem to be able to get a clean backtrace, and as you can see it 
rather seems to point to something happening in the video playback loop 
before the filter manager manages to get everything reinitialised in 
ReInitVideo

Although others don't seem to be able to easily repro this, it looks 
like a race condition because if I do some kind of background process 
such as a compile, then I don't get the segfault.  But if I then suspend 
the compile it reliably starts segfaulting again.  Note that I have a 
pentium 4 with hyperthreading enabled and an smp enabled kernel - so the 
kernel thinks it has more processors than it really does.

Some details would be helpful: I have the kerneldeint filter enabled 
(disabling stops the segfault), normal xv output to an nvidia 5200fx.  
The recording is a DVB mpeg2 recording.  The segfault was generated by 
running "mythtv" (not mythfrontend) on the same file I posted way back:
http://www.wildgooses.com/downloads/duff2.nuv

Help diagnosing this would be appreciated.  Thanks

Ed W

P.S. More backtraces of the same event show basically the same key lines 
of code.  They are large so get them from:
http://www.wildgooses.com/downloads/aspect_bt2.txt
http://www.wildgooses.com/downloads/aspect_bt3.txt

-------------- next part --------------
bash-2.05b$ gdb mythtv
GNU gdb 6.1.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) set args duff2.nuv
(gdb) r
Starting program: /usr/bin/mythtv duff2.nuv
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 16550)]
[New Thread 32769 (LWP 16556)]
[New Thread 16386 (LWP 16557)]
2004-06-25 11:14:13 Connecting to backend server: 127.0.0.1:6543 (try 1 of 5)
2004-06-25 11:14:13 Using protocol version 9
ERROR: couldn't find recorder for in-progress recording
2004-06-25 11:14:14 Using protocol version 9
[New Thread 32771 (LWP 16558)]
[New Thread 49156 (LWP 16559)]
Input #0, mpeg, from 'duff2.nuv':
  Stream #0.0: Video: mpeg2video, 704x576, 25.00 fps
  Stream #0.1: Audio: mp2, 48000 Hz, stereo, 192 kb/s
2004-06-25 11:14:15 Opening OSS audio device '/dev/dsp1'.
2004-06-25 11:14:15 Audio fragment size: 4096
[New Thread 65541 (LWP 16560)]
2004-06-25 11:14:15 Using XV port 146
2004-06-25 11:14:15 Changing from None to WatchingRecording
[New Thread 81926 (LWP 16561)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 32771 (LWP 16558)]
0x41415086 in _int_malloc () from /lib/libc.so.6
(gdb) thread apply all bt full

Thread 7 (Thread 81926 (LWP 16561)):
#0  KDP_MMX (
    Plane=0x44a07000 ".,+*('*-%&&'(())*('*-,(#&&''('''))*)((()(&''*('$$&()()+-''(('%$#%%%$\"\"$(('&%$#\"\"%## \037\036 \037&&&%#\"'.(# \036\037#%##\"\"!!!!\037 \037 \037!\037\036\034\036 \"! \036\035\036$\"\037\035\034\034\035\037  \037\036\034\034\035\035\033\033\034\034\033\032\032\033\033\033\033\033\033\033\033\031\032\033\033\033\033\033\033\032\031\032\033\032\032\033\033\032\033\033\031\031\031\032\032\033\032\033\033\033\033\031\031\030\033\033\033\032\031\031\030\027"...,
    Line=0x81b0358 "552..244+,.//.,+.))043/-,,+,,-///,+,,,+,+,-,,,-,**)**+--,+******)))+,+(&&'$$#%$&%&&&&''''&%%%(.3,'###\"!\"3YaUWWU^", 'Z' <repeats 48 times>, "YYYZ\\][ZWcD \032\037 \033\036\036\037\036\036\037\036\036\036     \037\036\035\036\035\036\035\036\035\034"..., W=704, H=576, Threshold=12)
    at filter_kerneldeint.c:315
        X = 480
        Y = 18
        LineCur = (
    uint8_t *) 0x44a0db40 "552..244+,.//.,+.))043/-,,+,,-///,+,,,+,+,-,,,-,**)**+--,+******)))+,+(&&'$$#%$&%&&&&''''&%%%(.3,'###\"!\"3YaUWWU^", 'Z' <repeats 48 times>, "YYYZ\\][ZWcD \032\037 \033\036\036\037\036\036\037\036\036\036     \037\036\035\036\035\036\035\036\035\034"...
---Type <return> to continue, or q <return> to quit---
        LineCur1U = (
    uint8_t *) 0x44a0d880 "452.-133+,.//.,+/(*/62/+,++*+,-..,", '+' <repeats 11 times>, ",-,))*,,,,--+***)()(((+,*(&'%%\"##&%%%&''((('&&%&(-2+%\"\"#\"\"$0YaSY\\W]", 'Z' <repeats 51 times>, "YXXYZZ_<\031\034 \037\032\037\037\037\037\037\037\037\036\037  \037\037\037\036\036\036\035\036\035\036\035\036\033"...
        LineCur1D = (
    uint8_t *) 0x44a0de00 "221-/487++++,,,,20..00-)*+,-.--,/-,,,,,---..-,-,,,+**+-.,+*+*+++&*'$&'(+(('(((&%#%')))(&%&&$$(.3.'\"#&%$%QVZZY[[Y", 'Z' <repeats 56 times>, "X[U-\027\036\033\034\036\036\036\036\037\037\037\036  !\"\"\"\"!\037\037\037\037\037\037\037\036"...
        LineCur2D = (
    uint8_t *) 0x44a0e0c0 "120-/466++,,---./-,.21.+*+,-.--,.,,,,-------,,+,,--,,,-.,+++*++**+)'))''((&''('%$&'))(&%%%%##&-3.(#$'&%&QVZZY[[Y", 'Z' <repeats 56 times>, "X[U.\030\037\034\035\036\037\036\036  \037\036  !!\"!\"\"\036\036\035\034\035\037\037\035"...
        tmp = 8 '\b'
        mm_lthr = {q = -3096271989178380, uq = 18443647801720373236, d = {
    -720908, -720908}, ud = {4294246388, 4294246388}, w = {-12, -12, -12,
    -12}, uw = {65524, 65524, 65524, 65524}, b = "ôÿôÿôÿôÿ",
  ub = "ôÿôÿôÿôÿ", s = {-nan(0x74fff4), -nan(0x74fff4)}}
        mm_hthr = {q = 3096271989178379, uq = 3096271989178379, d = {
---Type <return> to continue, or q <return> to quit---
    720907, 720907}, ud = {720907, 720907}, w = {11, 11, 11, 11}, uw = {
    11, 11, 11, 11}, b = "\v\000\v\000\v\000\v",
  ub = "\v\000\v\000\v\000\v", s = {1.01020587e-39, 1.01020587e-39}}
#1  0x42135743 in KernelDeint (f=0x8141620, frame=0x81b0c58)
    at filter_kerneldeint.c:369
        filter = (ThisFilter *) 0x8141620
#2  0x402f8fce in FilterChain::ProcessFrame (this=0x80ddbd8,
    Frame=0x81b0c58) at filtermanager.cpp:48
        VF = (VideoFilter *) 0x8141620
#3  0x4038b2f0 in VideoOutputXv::ProcessFrame (this=0x81b0620,
    frame=0x81b0c58, osd=0x81b75f8, filterList=0x80ddbd8, pipPlayer=0x0)
    at videoout_xv.cpp:929
No locals.
#4  0x401e9536 in NuppelVideoPlayer::OutputVideoLoop (this=0x42201e68)
    at NuppelVideoPlayer.cpp:1781
        frame = (VideoFrame *) 0x81b0c58
#5  0x401e9834 in NuppelVideoPlayer::kickoffOutputVideoLoop (
    player=0x42201e68) at NuppelVideoPlayer.cpp:1858
        nvp = (NuppelVideoPlayer *) 0x42201e68
#6  0x4128ddfb in pthread_start_thread () from /lib/libpthread.so.0
No symbol table info available.
#7  0x4128df8a in pthread_start_thread_event () from /lib/libpthread.so.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#8  0x4146301a in clone () from /lib/libc.so.6
No symbol table info available.
Current language:  auto; currently c

Thread 6 (Thread 65541 (LWP 16560)):
#0  0x41436a86 in nanosleep () from /lib/libc.so.6
No symbol table info available.
#1  0x00000000 in ?? ()
No symbol table info available.
#2  0x4145d6bc in usleep () from /lib/libc.so.6
No symbol table info available.
#3  0x4094d80e in AudioOutputOSS::OutputAudioLoop (this=0x437a4008)
    at audiooutputoss.cpp:594
        space_on_soundcard = 0
        zeros = "\000"
#4  0x4094dc94 in AudioOutputOSS::kickoffOutputAudioLoop (
    player=0x437a4008) at audiooutputoss.cpp:634
No locals.
#5  0x4128ddfb in pthread_start_thread () from /lib/libpthread.so.0
No symbol table info available.
#6  0x4128df8a in pthread_start_thread_event () from /lib/libpthread.so.0
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#7  0x4146301a in clone () from /lib/libc.so.6
No symbol table info available.

Thread 5 (Thread 49156 (LWP 16559)):
#0  0x41436a86 in nanosleep () from /lib/libc.so.6
No symbol table info available.
#1  0x00000000 in ?? ()
No symbol table info available.
#2  0x4145d6bc in usleep () from /lib/libc.so.6
No symbol table info available.
#3  0x4025eecf in RingBuffer::safe_read (this=0x80fff70, fd=19,
    data=0x4348f008, sz=256000) at RingBuffer.cpp:493
        ret = 0
        tot = 0
        errcnt = 0
        zerocnt = 12
#4  0x4025f939 in RingBuffer::ReadAheadThread (this=0x80fff70)
    at RingBuffer.cpp:712
        totfree = 256000
        ret = 98304
        used = 2293761
#5  0x4025f6d7 in RingBuffer::startReader (type=0x80fff70)
---Type <return> to continue, or q <return> to quit---
    at RingBuffer.cpp:660
        rbuffer = (RingBuffer *) 0x80fff70
#6  0x4128ddfb in pthread_start_thread () from /lib/libpthread.so.0
No symbol table info available.
#7  0x4128df8a in pthread_start_thread_event () from /lib/libpthread.so.0
No symbol table info available.
#8  0x4146301a in clone () from /lib/libc.so.6
No symbol table info available.

Thread 4 (Thread 32771 (LWP 16558)):
#0  0x41415086 in _int_malloc () from /lib/libc.so.6
No symbol table info available.
#1  0x4141429b in malloc () from /lib/libc.so.6
No symbol table info available.
#2  0x41363777 in operator new ()
   from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5
No symbol table info available.
#3  0x410fe519 in QStringList::split () from /usr/qt/3/lib/libqt-mt.so.3
No symbol table info available.
#4  0x402f9bab in FilterManager::LoadFilters (this=0x42202360, Filters=
      {static null = {static null = <same as static member of an already seen type>, d = 0x804e0b8, static shared_null = 0x804e0b8}, d = 0x422010b8, sta---Type <return> to continue, or q <return> to quit---
tic shared_null = 0x804e0b8}, inpixfmt=@0x42aff6e0, outpixfmt=@0x42aff6dc,
    width=@0x42201e7c, height=@0x42201e80, bufsize=@0x42aff6d8)
    at filtermanager.cpp:148
        FiltInfoChain = {<QGList> = {<> = {<No data fields>},
    firstNode = 0x0, lastNode = 0x0, curNode = 0x0, curIndex = -1,
    numNodes = 0, iterators = 0x0}, <No data fields>}
        FiltChain = (FilterChain *) 0x80ddbd8
        FmtList = {<QGList> = {<> = {<No data fields>}, firstNode = 0x0,
    lastNode = 0x0, curNode = 0x0, curIndex = -1, numNodes = 0,
    iterators = 0x0}, <No data fields>}
        FI = (FilterInfo *) 0x42aff64c
        FI2 = (FilterInfo *) 0x414b9308
        Opts = {static null = {
    static null = <same as static member of an already seen type>,
    d = 0x804e0b8, static shared_null = 0x804e0b8}, d = 0x804e0b8,
  static shared_null = 0x804e0b8}
        Convert = (FilterInfo *) 0x42202420
        OptsList = {<QPtrList<char>> = {<QGList> = {<> = {<No data fields>}, firstNode = 0x0, lastNode = 0x0, curNode = 0x0, curIndex = -1,
      numNodes = 0, iterators = 0x0}, <No data fields>}, dc = true}
        FilterList = {<QValueList<QString>> = {
    sh = 0x812bb38}, <No data fields>}
---Type <return> to continue, or q <return> to quit---
        NewFilt = (VideoFilter *) 0x40034000
        FC = (FmtConv *) 0x42aff634
        FC2 = (FmtConv *) 0xbc67f96
        S1 = (FmtConv *) 0x400075b0
        S2 = (FmtConv *) 0x42affbe0
        S3 = (FmtConv *) 0x0
        ifmt = FMT_YV12
        i = 1118827968
        nbufsize = 1095474400
        cbufsize = 1094799394
        postfilt_width = 1
        postfilt_height = 0
#5  0x401e4d5d in NuppelVideoPlayer::InitFilters (this=0x42201e68)
    at NuppelVideoPlayer.cpp:610
        itmp = FMT_YV12
        otmp = FMT_YV12
        btmp = 1073783161
#6  0x401e3c0f in NuppelVideoPlayer::ReinitVideo (this=0x42201e68)
    at NuppelVideoPlayer.cpp:419
No locals.
#7  0x402f40ab in AvFormatDecoder::MpegPreProcessPkt (this=0x8100050,
    stream=0x81001b0, pkt=0x80cde30) at avformatdecoder.cpp:950
---Type <return> to continue, or q <return> to quit---
        test = (
    unsigned char *) 0x811ce64 ",\002@#$\237#Y\020\021\021\022\022\022\023\023\023\023\024\024\024\024\024\025\025\025\025\025\025\026\026\026\026\026\026\026\027\027\027\027\027\027\027\027\030\030\030\031\030\030\030\031\032\032\032\032\031\033\033\033\033\033\034\034\034\034\036\036\036\037\037!"
        aspectratioinfo = 2
        aspect = 1.33333337
        width = 704
        height = 576
        context = (AVCodecContext *) 0x81001b8
        bufptr = (
    unsigned char *) 0x811ce64 ",\002@#$\237#Y\020\021\021\022\022\022\023\023\023\023\024\024\024\024\024\025\025\025\025\025\025\026\026\026\026\026\026\026\027\027\027\027\027\027\027\027\030\030\030\031\030\030\030\031\032\032\032\032\031\033\033\033\033\033\034\034\034\034\036\036\036\037\037!"
        state = 435
        v = 179
        prvcount = 70
#8  0x402f465f in AvFormatDecoder::GetFrame (this=0x8100050, onlyvideo=0)
    at avformatdecoder.cpp:1120
        context = (AVCodecContext *) 0x81001b8
        curstream = (AVStream *) 0x81001b0
---Type <return> to continue, or q <return> to quit---
        pkt = (AVPacket *) 0x80cde30
        len = 18993
        ret = 0
        ptr = (unsigned char *) 0x811ce20 ""
        samples = (short int *) 0x45eb2008
        data_size = 0
        pts = 0
        firstloop = false
        allowedquit = false
        storevideoframes = false
#9  0x401e5175 in NuppelVideoPlayer::GetFrame (this=0x42201e68,
    onlyvideo=0, unsafe=false) at NuppelVideoPlayer.cpp:704
No locals.
#10 0x401ea93d in NuppelVideoPlayer::StartPlaying (this=0x42201e68)
    at NuppelVideoPlayer.cpp:2126
        output_video = 81926
        pausecheck = 0
#11 0x402855c9 in SpawnDecode (param=0x42201e68) at tv_play.cpp:169
        nvp = (NuppelVideoPlayer *) 0x42201e68
#12 0x4128ddfb in pthread_start_thread () from /lib/libpthread.so.0
No symbol table info available.
#13 0x4128df8a in pthread_start_thread_event () from /lib/libpthread.so.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#14 0x4146301a in clone () from /lib/libc.so.6
No symbol table info available.

Thread 3 (Thread 16386 (LWP 16557)):
#0  0x41436a86 in nanosleep () from /lib/libc.so.6
No symbol table info available.
#1  0x00000000 in ?? ()
No symbol table info available.
#2  0x4145d6bc in usleep () from /lib/libc.so.6
No symbol table info available.
#3  0x4028cd85 in TV::RunTV (this=0x80fb700) at tv_play.cpp:1019
        keypressed = (QKeyEvent *) 0x42123be0
        updatecheck = 12
#4  0x4028caff in TV::EventThread (param=0x80fb700) at tv_play.cpp:985
        thetv = (class TV *) 0x80fb700
#5  0x4128ddfb in pthread_start_thread () from /lib/libpthread.so.0
No symbol table info available.
#6  0x4128df8a in pthread_start_thread_event () from /lib/libpthread.so.0
No symbol table info available.
#7  0x4146301a in clone () from /lib/libc.so.6
No symbol table info available.
---Type <return> to continue, or q <return> to quit---

Thread 2 (Thread 32769 (LWP 16556)):
#0  0x4145afe6 in poll () from /lib/libc.so.6
No symbol table info available.
#1  0x4128d962 in __pthread_manager () from /lib/libpthread.so.0
No symbol table info available.
#2  0x4128dc1e in __pthread_manager_event () from /lib/libpthread.so.0
No symbol table info available.
#3  0x4146301a in clone () from /lib/libc.so.6
No symbol table info available.

Thread 1 (Thread 16384 (LWP 16550)):
#0  0x41436a86 in nanosleep () from /lib/libc.so.6
No symbol table info available.
#1  0x00000000 in ?? ()
No symbol table info available.
#2  0x4145d6bc in usleep () from /lib/libc.so.6
No symbol table info available.
#3  0x08049fde in main (argc=2, argv=0xbfffdd54) at main.cpp:77
        a = <incomplete type>
        themename = {static null = {
    static null = <same as static member of an already seen type>,
---Type <return> to continue, or q <return> to quit---
    d = 0x804e0b8, static shared_null = 0x804e0b8}, d = 0x80ce910,
  static shared_null = 0x804e0b8}
        themedir = {static null = {
    static null = <same as static member of an already seen type>,
    d = 0x804e0b8, static shared_null = 0x804e0b8}, d = 0x80dfb48,
  static shared_null = 0x804e0b8}
        db = (struct QSqlDatabase *) 0x80dfc10
        auddevice = {static null = {
    static null = <same as static member of an already seen type>,
    d = 0x804e0b8, static shared_null = 0x804e0b8}, d = 0x80e3cf8,
  static shared_null = 0x804e0b8}
        mainWindow = (class MythMainWindow *) 0x80e9470
        tv = (class TV *) 0x80fb700
#0  0x41415086 in _int_malloc () from /lib/libc.so.6


More information about the mythtv-dev mailing list