GNOME Bugzilla – Bug 727102
rtsp-media: deadlock with dynamic pipelines when preroll fails
Last modified: 2014-04-08 12:53:58 UTC
I've ht a deadlock when having a dynamic pipeline and the preroll fails because of a timeout waiting for the preroll to happen. The problem is that a timeout happens while waiting for prerolling to happen. Then, th emedia is unprepared. However, the dynamic pipeline is still working and finally adds a pad, therefore calling rtsp-media:pad_added_cb while the media is unpreparing. Thread 2 shows the dynamic pipeline, Thread 6 show how the media is being prepared and then unprepared. Also, in Thread 4 the bus source is also waiting for state_lock to unblock. -----
+ Trace 233397
Thread 2 (Thread 0x7fbcaffff700 (LWP 7806))
The old backtrace had some changes so it would be hard for you to get to the right lines. The following backtrace has been obtained with commit dffdbbf0906201ec6d6711d1e80e6245182d517c -----
+ Trace 233398
Thread 2 (Thread 0x7fdc927fc700 (LWP 12007))
Created attachment 273010 [details] [review] don't add stream if media is not preparing The following patch solves the deadlock, but I'm not really convinced is the right way to do this. Probably a better way to do this would be making the preroll asynchronous as suggested by the FIXME note in the code. I think it would fix it too.
Please check if this fixes it as well: commit fd5e949169d71fe23102d6120853e28ef45f5ae4 Author: Wim Taymans <wtaymans@redhat.com> Date: Tue Apr 8 14:49:41 2014 +0200 media: release the state lock when going to NULL Set our state to UNPREPARING and release the state-lock before setting the pipeline to the NULL state. This way, any pad-added callback will be able to take the state-lock and check that we are now unpreparing instead of deadlocking. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727102