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 485753 - Decodebin2 deadlocks when nulling pipeline during typefind
Decodebin2 deadlocks when nulling pipeline during typefind
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 0.10.15
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Reported: 2007-10-11 14:54 UTC by Tommi Myöhänen
Modified: 2007-10-16 16:48 UTC
See Also:
GNOME target: ---
GNOME version: ---

dbin2-deadlock.c test player (2.67 KB, text/plain)
2007-10-11 14:55 UTC, Tommi Myöhänen
decodebin2:5,GST_STATES:5,typefind:5 gst.log (57.61 KB, application/octet-stream)
2007-10-11 14:58 UTC, Tommi Myöhänen

Description Tommi Myöhänen 2007-10-11 14:54:37 UTC
Steps to reproduce the problem:
1. Set playbin with some uri to PLAYING
2. when typefind element is performing typefind, set playbin to NULL

This is what I think happens next:
* Decodebin2 takes its state_lock and starts setting its children from PAUSED to READY 
* Typefind element won't switch to READY until it finishes its typefinding and has emitted have_type signal
* type_found callback in decodebin2 tries to take state_lock too and pipeline deadlocks.

I can reproduce the problem with attached test player:
$ GST_DEBUG=GST_STATES:5,typefind:5,decodebin2:5 ./dbin2-deadlock 2> gst.log
Starting pipeline
Got state-changed message from play
Got clock-provide message from play
Got state-changed message from test
Got state-changed message from async-fakesink
Got state-changed message from typefind
typefind changed state to 2
Got state-changed message from decodebin20
Got state-changed message from typefind
typefind changed state to 3
Got state-changed message from source
Got state-changed message from source
Got buffer 1 with size 1171
Got buffer 2 with size 1448
Nulling pipeline

One way to fix this would be to connect/disconnect type_found callback in READY_TO_PAUSED/PAUSED_TO_READY state changes in decodebin2.
Comment 1 Tommi Myöhänen 2007-10-11 14:55:31 UTC
Created attachment 97064 [details]
dbin2-deadlock.c test player
Comment 2 Tommi Myöhänen 2007-10-11 14:58:14 UTC
Created attachment 97065 [details]
decodebin2:5,GST_STATES:5,typefind:5 gst.log
Comment 3 Wim Taymans 2007-10-15 14:21:15 UTC
decodebin used to check for shutdown right after taking locks, this was removed.
Comment 4 Wim Taymans 2007-10-16 11:31:35 UTC
actually, it also fails with decodebin.
Comment 5 Wim Taymans 2007-10-16 16:48:34 UTC
        * gst/playback/gstdecodebin.c: (new_pad), (type_found):
        Make the window for a race in typefind and shutting down smaller until
        we figure out the right locking here. Avoids #485753 usually.

        * gst/playback/gstdecodebin2.c: (type_found), (pad_added_group_cb):
        Remove unneeded lock causing a race in typefind and shutting down.
        Fixes #485753.

        * gst/playback/gstplaybin.c: (gst_play_bin_change_state):
        Also remove sinks when going to NULL because we might not complete the
        state change to PAUSED, causing the PAUSED->READY state change not to