GNOME Bugzilla – Bug 569437
mpegtsparse: flow error or crashes while dynamicly changing program-numbers property
Last modified: 2009-05-03 16:13:44 UTC
Please describe the problem: See the following python program which dynamicly change the mpegtsparse's "program-numbers" property. This dynamic change is not working well : there is sometime a "GST_FLOW_NOT_LINKED" error while the new pad is added (when new program entry is added to the property) and rarely a segmentation fault while removing a pad (when a program is removed from the property). Steps to reproduce: See the attached python sample program. This sample program reads a MPTS stream from an UDP multicast address (you can use vlc to stream a MPTS file as a source) Actual results: -> many time the sample program is working well -> but after a while, there is a GST_FLOW_NOT_LINKED error or a segmentation fault Expected results: Does this happen every time? Other information: The segmentation is rare so here is a stack trace obtained using gdb: $ gdb --args python test_tsparse.py register program 6905 counter: 1 pad added linking linked [New Thread 0xb64ffb90 (LWP 14586)] [Thread 0xb64ffb90 (LWP 14586) exited] unregister program 6905 pad removed [....] register program 6905 counter:28 pad added linking linked [New Thread 0xb64ffb90 (LWP 14587)] [Thread 0xb64ffb90 (LWP 14587) exited] unregister program 6905 pad removed Program received signal SIGSEGV, Segmentation fault.
+ Trace 211960
Thread 3077278608 (LWP 14569)
$1 = (MpegTSParseProgram *) 0x30657372 (gdb) print tspad->program->streams Cannot access memory at address 0x3065737e In fact, I suppose this bug is due to concurrent accesses to the element data (MpegTSParse->programs) between the task thread and the application thread (trought the set_property). I am working on a patch...
Created attachment 127386 [details] test case This python test program is indefinitly adding/removing a program-number to the mpegtsparse "program-numbers" property. There is an error or a crash after a while...
Created attachment 127393 [details] [review] proposed patch This patch moves the pad creation/removal into the pad task : this avoids calls to gst_tspad_push on freed structures.
Thanks for the patch, now committed: commit 8ef8daf4dbdbab23ff49757a6223c3a9bfba11d3 Author: Vincent Genieux <mutex@runbox.com> Date: Sun May 3 17:21:22 2009 +0100 mpegtsparse: make safe changing the program-numbers property dynamically Fixes #569437.