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 577671 - [rtspsrc] deadlock on shutdown (locking order problem?)
[rtspsrc] deadlock on shutdown (locking order problem?)
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: 0.10.15
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-04-02 00:39 UTC by Tim-Philipp Müller
Modified: 2009-04-29 16:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch: don't take STATE_LOCK in streaming thread, use atomic ops for src->state instead (4.51 KB, patch)
2009-04-04 12:45 UTC, Tim-Philipp Müller
none Details | Review

Description Tim-Philipp Müller 2009-04-02 00:39:23 UTC
Running the test program from bug #577318 I quickly get deadlocks like this:

(gdb) thread apply all bt


which looks like a locking order problem to me:

 - streaming thread takes STREAMING_LOCK in _loop()

 - application thread in gst_rtspsrc_close():
     - takes STATE_LOCK
     - does gst_task_stop()
     - takes STREAM_LOCK, waits for streaming thread to release it

 - streaming thread takes STATE_LOCK in _loop_interleaved(),
   waits for application thread to release it

Not 100% sure what the correct solution is at this point, so just filing a bug for now.
Comment 1 Tim-Philipp Müller 2009-04-04 12:45:02 UTC
Created attachment 132070 [details] [review]
patch: don't take STATE_LOCK in streaming thread, use atomic ops for src->state instead

Possible patch attached.
Comment 2 Wim Taymans 2009-04-29 16:12:14 UTC
A slightly less intrusive patch, please test if this fixes things too.

commit de0a2575fc277cbe18979f18c58a799376f21e49
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Wed Apr 29 18:09:07 2009 +0200

    rtspsrc: release state lock before stopping task
    
    We need to release the state lock before trying to wait for the task to end
    because the task might also take the lock.
    
    Fixes #577671