[vdr] VDR 1.7 FreeBSD segfault when cutting recordings

Juergen Lock vdr-l at jelal.kn-bremen.de
Sun Mar 17 21:52:46 CET 2013


In article <20130316082610.GJ23851 at t60.brauer.lan> you write:
>On Fri, Mar 15, 2013 at 10:54:04AM +0100, Gerhard Brauer wrote:
>> 
>> I never have any problem during other actions with the remote VDR
>> (recording, viewing, place cutting marks,...) _exept_ when i start
>> the cutting procedere itself with the keyboard shortcut "2".
>> Most times (> 95%) the remote vdr segfaults immidiatly. The file
>> structure is still created (%foobar ff.). In the few times when it
>> not segfaults then the cutting is done well without problems.
>
>Hello again,
>
>I've learned that i could also start the cutting process on the vdr
>server itself, without a frontend. With this i also (and 100%
>reproducable) got the segfault of the vdr.
>
>I start without a running vdr:
>s01# vdr -u vdr --edit=/video/Die_Marx_Brothers_im_Kaufhaus/2012-10-29.01.48.50.99.rec/
>and also with a still running vdr and call the --edit with another instance:
>vdr -u vdr -i 1 --edit=/video/Die_Marx_Brothers_im_Kaufhaus/2012-10-29.01.48.50.99.rec/
>
>From both tries i make backtraces with gdb, both differs only in
>thread numbering etc.
>So i attach the one with -i 1 instance, along with the vdr logfile
>output. Maybe one of you see a clearer picture why this segfaults
>happen here.
>
>I attach logfile sequence and backtrace output together.
> 
>Regards and TIA
> 
>        Gerhard
> 
>
>
>--M/SuVGWktc5uNpra
>Content-Type: text/plain; charset=us-ascii
>Content-Disposition: attachment; filename="log+backtrace.txt"
>Content-Transfer-Encoding: quoted-printable
>
>[Here i restarted the vdr on the server]
>
>Mar 16 08:30:09 s01 vdr: [50361344] VDR version 1.7.29 started
>Mar 16 08:30:09 s01 vdr: [50361344] switched to user 'vdr'
>Mar 16 08:30:09 s01 vdr: [50361344] running as daemon (tid=3D50361344)
>Mar 16 08:30:09 s01 vdr: [50361344] codeset is 'UTF-8' - known
>Mar 16 08:30:09 s01 vdr: [50361344] found 28 locales in /usr/local/share/lo=
>cale
>Mar 16 08:30:09 s01 vdr: [50361344] loading plugin: /usr/local/lib/vdr/libv=
>dr-xineliboutput.so.1.7.29
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/setup.conf
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/sources.conf
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/diseqc.conf
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/scr.conf
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/channels.conf
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/timers.conf
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/svdrphosts.c=
>onf
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/remote.conf
>Mar 16 08:30:09 s01 vdr: [50361344] loading /usr/local/etc/vdr/keymacros.co=
>nf
>Mar 16 08:30:09 s01 vdr: [50363392] video directory scanner thread started =
>(pid=3D15494, tid=3D50363392)
>Mar 16 08:30:09 s01 vdr: [50361344] registered source parameters for 'A - A=
>TSC'
>Mar 16 08:30:09 s01 vdr: [50365440] epg data reader thread started (pid=3D1=
>5494, tid=3D50365440)
>Mar 16 08:30:09 s01 vdr: [50364416] video directory scanner thread started =
>(pid=3D15494, tid=3D50364416)
>Mar 16 08:30:09 s01 vdr: [50361344] registered source parameters for 'C - D=
>VB-C'
>Mar 16 08:30:09 s01 vdr: [50361344] registered source parameters for 'S - D=
>VB-S'
>Mar 16 08:30:09 s01 vdr: [50361344] registered source parameters for 'T - D=
>VB-T'
>Mar 16 08:30:09 s01 vdr: [50361344] probing /dev/dvb/adapter0/frontend0
>Mar 16 08:30:09 s01 vdr: [50365440] reading EPG data from /video/epg.data
>Mar 16 08:30:09 s01 vdr: [50361344] creating cDvbDevice
>Mar 16 08:30:09 s01 vdr: [50361344] new device number 1
>Mar 16 08:30:09 s01 vdr: [50361344] frontend 0/0 provides DVB-T with QPSK,Q=
>AM16,QAM64 ("DiBcom 7000PC")
>Mar 16 08:30:09 s01 vdr: [50361344] found 1 DVB device
>Mar 16 08:30:09 s01 vdr: [50366464] tuner on frontend 0/0 thread started (p=
>id=3D15494, tid=3D50366464)
>Mar 16 08:30:09 s01 vdr: [50361344] initializing plugin: xineliboutput (1.0=
>=2E90-cvs): X11/xine-lib Ausgabe-Plugin
>Mar 16 08:30:09 s01 vdr: [50366464] cTimeMs: using monotonic clock (resolut=
>ion is 70 ns)
>Mar 16 08:30:09 s01 vdr: [50367488] section handler thread started (pid=3D1=
>5494, tid=3D50367488)
>Mar 16 08:30:09 s01 vdr: [50361344] new device number 64
>Mar 16 08:30:09 s01 vdr: [50361344] setting primary device to 2
>Mar 16 08:30:09 s01 vdr: [50364416] video directory scanner thread ended (p=
>id=3D15494, tid=3D50364416)
>Mar 16 08:30:10 s01 vdr: [50361344] assuming manual start of VDR
>Mar 16 08:30:10 s01 vdr: [50361344] SVDRP listening on port 6419
>Mar 16 08:30:10 s01 vdr: [50361344] setting current skin to "lcars"
>Mar 16 08:30:10 s01 vdr: [50361344] loading /usr/local/etc/vdr/themes/lcars=
>-default.theme
>Mar 16 08:30:10 s01 vdr: [50361344] starting plugin: xineliboutput
>Mar 16 08:30:10 s01 vdr: [50365440] epg data reader thread ended (pid=3D154=
>94, tid=3D50365440)
>Mar 16 08:30:10 s01 vdr: [50370560] Remote decoder/display server (cXinelib=
>Server) thread started (pid=3D15494, tid=3D50370560)
>Mar 16 08:30:10 s01 vdr: [discovery] discovery_init: bind() failed
>Mar 16 08:30:10 s01 vdr: [discovery]    (ERROR (tools/vdrdiscovery.c,73): C=
>an't assign requested address)
>Mar 16 08:30:10 s01 vdr: [discovery] UDP broadcast send failed (discovery)
>Mar 16 08:30:10 s01 vdr: [discovery]    (ERROR (tools/vdrdiscovery.c,97): B=
>ad file descriptor)
>Mar 16 08:30:10 s01 vdr: [50363392] video directory scanner thread ended (p=
>id=3D15494, tid=3D50363392)
>Mar 16 08:30:10 s01 vdr: [50361344] switching to channel 16
>Mar 16 08:30:10 s01 vdr: [50371584] receiver on device 1 thread started (pi=
>d=3D15494, tid=3D50371584)
>Mar 16 08:30:10 s01 vdr: [67295232] TS buffer on device 1 thread started (p=
>id=3D15494, tid=3D67295232)
>Mar 16 08:30:10 s01 vdr: [50361344] OSD size changed to 720x576 @ 1.42222
>
>[Here 08:30:39 i started the --edit from another commandline on the server]
>
>Mar 16 08:30:39 s01 vdr: [50361344] loading /video/Die_Marx_Brothers_im_Kau=
>fhaus/2012-10-29.01.48.50.99.rec///marks.vdr
>Mar 16 08:30:39 s01 vdr: [50361344] loading /video/Die_Marx_Brothers_im_Kau=
>fhaus/2012-10-29.01.48.50.99.rec///marks.vdr
>Mar 16 08:30:39 s01 vdr: [50361344] removing /video/%Die_Marx_Brothers_im_K=
>aufhaus/2012-10-29.01.58.50.99.rec/001.vdr
>Mar 16 08:30:39 s01 vdr: [50361344] removing /video/%Die_Marx_Brothers_im_K=
>aufhaus/2012-10-29.01.58.50.99.rec/info.vdr
>Mar 16 08:30:39 s01 vdr: [50361344] removing /video/%Die_Marx_Brothers_im_K=
>aufhaus/2012-10-29.01.58.50.99.rec/index.vdr
>Mar 16 08:30:39 s01 vdr: [50361344] removing /video/%Die_Marx_Brothers_im_K=
>aufhaus/2012-10-29.01.58.50.99.rec
>Mar 16 08:30:39 s01 vdr: [50361344] creating directory /video/%Die_Marx_Bro=
>thers_im_Kaufhaus/2012-10-29.01.58.50.99.rec
>Mar 16 08:30:39 s01 vdr: [50361344] loading /video/Die_Marx_Brothers_im_Kau=
>fhaus/2012-10-29.01.48.50.99.rec///marks.vdr
>Mar 16 08:30:39 s01 vdr: [50361344] playing '/video/Die_Marx_Brothers_im_Ka=
>ufhaus/2012-10-29.01.48.50.99.rec//001.vdr'
>Mar 16 08:30:39 s01 vdr: [50361344] recording to '/video/%Die_Marx_Brothers=
>_im_Kaufhaus/2012-10-29.01.58.50.99.rec/001.vdr'
>Mar 16 08:30:39 s01 vdr: [50362368] video cutting thread started (pid=3D154=
>96, tid=3D50362368)
>Mar 16 08:30:40 s01 kernel: pid 15496 (vdr), uid 0: exited on signal 11 (co=
>re dumped)
>
>
>[backtrace output]
>Script started on Sat Mar 16 08:31:41 2013
>gdb /usr/local/bin/vdr ./vdr.core=0D
>GNU gdb 6.1.1 [FreeBSD]=0D
>Copyright 2004 Free Software Foundation, Inc.=0D
>GDB is free software, covered by the GNU General Public License, and you ar=
>e=0D
>welcome to change it and/or distribute copies of it under certain condition=
>s.=0D
>Type "show copying" to see the conditions.=0D
>There is absolutely no warranty for GDB.  Type "show warranty" for details.=
>=0D
>This GDB was configured as "amd64-marcel-freebsd"...=0D
>Core was generated by `vdr'.=0D
>Program terminated with signal 11, Segmentation fault.=0D
>Reading symbols from /usr/local/lib/libjpeg.so.11...done.=0D
>Loaded symbols for /usr/local/lib/libjpeg.so.11=0D
>Reading symbols from /lib/libthr.so.3...done.=0D
>Loaded symbols for /lib/libthr.so.3=0D
>Reading symbols from /usr/lib/librt.so.1...done.=0D
>Loaded symbols for /usr/lib/librt.so.1=0D
>Reading symbols from /lib/libutil.so.9...done.=0D
>Loaded symbols for /lib/libutil.so.9=0D
>Reading symbols from /usr/local/lib/libintl.so.9...done.=0D
>Loaded symbols for /usr/local/lib/libintl.so.9=0D
>Reading symbols from /usr/local/lib/libiconv.so.3...done.=0D
>Loaded symbols for /usr/local/lib/libiconv.so.3=0D
>Reading symbols from /usr/local/lib/libfreetype.so.9...done.=0D
>Loaded symbols for /usr/local/lib/libfreetype.so.9=0D
>Reading symbols from /usr/local/lib/libfontconfig.so.1...done.=0D
>Loaded symbols for /usr/local/lib/libfontconfig.so.1=0D
>Reading symbols from /usr/lib/libstdc++.so.6...done.=0D
>Loaded symbols for /usr/lib/libstdc++.so.6=0D
>Reading symbols from /lib/libm.so.5...done.=0D
>Loaded symbols for /lib/libm.so.5=0D
>Reading symbols from /lib/libgcc_s.so.1...done.=0D
>Loaded symbols for /lib/libgcc_s.so.1=0D
>Reading symbols from /lib/libc.so.7...done.=0D
>Loaded symbols for /lib/libc.so.7=0D
>Reading symbols from /lib/libz.so.6...done.=0D
>Loaded symbols for /lib/libz.so.6=0D
>Reading symbols from /usr/lib/libbz2.so.4...done.=0D
>Loaded symbols for /usr/lib/libbz2.so.4=0D
>Reading symbols from /usr/local/lib/libexpat.so.6...done.=0D
>Loaded symbols for /usr/local/lib/libexpat.so.6=0D
>Reading symbols from /libexec/ld-elf.so.1...done.=0D
>Loaded symbols for /libexec/ld-elf.so.1=0D
>#0  0x00000008023f93b5 in fprintf () from /lib/libc.so.7=0D
>[New Thread 803007800 (LWP 101624/vdr)]=0D
>[New Thread 803007400 (LWP 100464/vdr)]=0D
>(gdb) =07thread apl=07=08=1B[Kply all bt=0D
>=0D
>Thread 2 (Thread 803007400 (LWP 100464/vdr)):=0D
>#0  0x0000000800bf19bc in pthread_kill () from /lib/libthr.so.3=0D
>#1  0x0000000800bebdb3 in pthread_getschedparam () from /lib/libthr.so.3=0D
>#2  0x0000000800bf3dcd in pthread_cond_signal () from /lib/libthr.so.3=0D
>#3  0x00000000004f4694 in cCondWait::Wait (this=3D0x7fffffffd620, TimeoutMs=
>=3DVariable "TimeoutMs" is not available.=0D
>) at thread.c:78=0D
>#4  0x00000000004f480d in cCondWait::SleepMs (TimeoutMs=3D500) at thread.c:=
>67=0D
>#5  0x000000000046742a in CutRecording (=0D
>    FileName=3D0x7fffffffdd6f "/video/Die_Marx_Brothers_im_Kaufhaus/2012-10=
>-29.01.48.50.99.rec/") at cutter.c:334=0D
>#6  0x00000000004fdbe7 in main (argc=3D6, argv=3D0x7fffffffdad8) at vdr.c:2=
>78=0D
>=0D
>Thread 1 (Thread 803007800 (LWP 101624/vdr)):=0D
>#0  0x00000008023f93b5 in fprintf () from /lib/libc.so.7=0D
>#1  0x00000008023f08e8 in vsyslog () from /lib/libc.so.7=0D
>#2  0x00000000004f9fb0 in syslog_with_tid (priority=3D3, =0D
>    format=3D0x529408 "ERROR: syscall(SYS_ioprio_set ...) unsupported on Fr=
>eeBSD") at tools.c:51=0D
>#3  0x0000000000465d8b in cCuttingThread::Action (this=3D0x80309d140) at cu=
>tter.c:73=0D
>#4  0x00000000004f3e7c in cThread::StartThread (Thread=3D0x80309d140) at th=
>read.c:274=0D
>#5  0x0000000800bea274 in pthread_getprio () from /lib/libthr.so.3=0D
>#6  0x0000000000000000 in ?? ()=0D
>Cannot access memory at address 0x7fffffbfe000=0D
>(gdb) q=0D
>
>Script done on Sat Mar 16 08:32:50 2013
>
Ok I looked at cutter.c again and now I think I found the cause:
Linux must default to bigger thread stacks than FreeBSD, FreeBSD's
default seems to be 2 MB on amd64 and MAXFRAMESIZE is almost 1 MB...
Try the patch below, you can put it in files/patch-z-cutter.c
in the port dir. (the thread.c part is FreeBSD port specific, it
caused a different crash with --edit.)

 HTH, :)
	Juergen

--- cutter.c.orig
+++ cutter.c
@@ -83,7 +83,18 @@ void cCuttingThread::Action(void)
      int LastIFrame = 0;
      toMarks.Add(0);
      toMarks.Save();
+#ifdef __FreeBSD__
+     // XXX save thread stack space
+     uchar *buffer = MALLOC(uchar, MAXFRAMESIZE);
+     uchar *buffer2 = MALLOC(uchar, MAXFRAMESIZE);
+     if (buffer == NULL || buffer2 == NULL) {
+        free(buffer);
+        error = "malloc";
+        return;
+        }
+#else
      uchar buffer[MAXFRAMESIZE], buffer2[MAXFRAMESIZE];
+#endif
      int Length2;
      bool CheckForSeamlessStream = false;
      bool LastMark = false;
@@ -216,6 +227,10 @@ void cCuttingThread::Action(void)
               }
            }
      Recordings.TouchUpdate();
+#ifdef __FreeBSD__
+     free(buffer);
+     free(buffer2);
+#endif
      }
   else
      esyslog("no editing marks found!");
--- thread.c.orig
+++ thread.c
@@ -242,7 +242,7 @@ void cThread::SetPriority(int Priority)
 void cThread::SetIOPriority(int Priority)
 {
 #ifdef __FreeBSD__
-  esyslog("ERROR: syscall(SYS_ioprio_set ...) unsupported on FreeBSD");
+  // esyslog("ERROR: syscall(SYS_ioprio_set ...) unsupported on FreeBSD");
 #else
   if (syscall(SYS_ioprio_set, 1, 0, (Priority & 0xff) | (2 << 13)) < 0) // best effort class
      LOG_ERROR;



More information about the vdr mailing list