After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 572577 - [playbin2] deadlock on shutdown
[playbin2] deadlock on shutdown
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-02-20 17:10 UTC by Mark Nauwelaerts
Modified: 2009-02-24 12:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for using stress-playbin also with playbin2 (2.56 KB, patch)
2009-02-20 17:19 UTC, Mark Nauwelaerts
committed Details | Review
playbin2 patch to prevent deadlock (6.42 KB, patch)
2009-02-20 17:22 UTC, Mark Nauwelaerts
committed Details | Review

Description Mark Nauwelaerts 2009-02-20 17:10:15 UTC
Consider a playbin2 pipeline that is set to PAUSED, and (about) immediately upon return from set_state set to READY, then a race occurs between the (mainloop) thread trying to shutdown to READY, and streaming thread callbacks building the bin and prerolling to PAUSED.

In particular, with an internal decodebin2 not yet linked to downstream elements, mainloop may choose to move decodebin2 elements to READY first, and then tries to acquire STREAM_LOCK as part of pad deactivation.
In the meantime, streaming thread may then link decodebin2 to downstream elements, resume streaming and waiting prerolled for a state change.

A state change will not come as the mainloop is occupied trying to get the STREAM_LOCK, which it will not get as streaming is stuck PAUSED.
Comment 1 Mark Nauwelaerts 2009-02-20 17:19:42 UTC
Created attachment 129168 [details] [review]
Patch for using stress-playbin also with playbin2

Add some arguments to stress-playbin so playbin2 can be stressed as well, and allow for varying pipeline runtime.

In particular, run the patched test as follows:
./stress-playbin --bin playbin2 --runtime 10 <dir with some e.g. mp3(s)>
and the above deadlock is very likely to occur.
Comment 2 Mark Nauwelaerts 2009-02-20 17:22:21 UTC
Created attachment 129169 [details] [review]
playbin2 patch to prevent deadlock

* Use additional flag and lock to serialize and/or discourage further dynamic building when shutting down.
Comment 3 Wim Taymans 2009-02-24 11:26:06 UTC
Looks good, I don't know if adding the fakesinks does not cause further havoc but if the test case works I guess that should suffice.
Comment 4 Mark Nauwelaerts 2009-02-24 12:32:46 UTC
commit d24e75f9fab7b6fa3a729bddfa53e84592f72baf
Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Thu Feb 19 17:16:51 2009 +0100

    playbin2: fix deadlock when shutting down.  Fixes #572577.