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 732950 - deadlock after TEARDOWN
deadlock after TEARDOWN
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
git master
Other Linux
: Normal normal
: 1.3.91
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-07-09 14:53 UTC by Ognyan Tonchev (redstar_)
Modified: 2014-07-11 08:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
backtrace (13.18 KB, text/plain)
2014-07-09 14:53 UTC, Ognyan Tonchev (redstar_)
  Details
touch session from clients own context (2.74 KB, patch)
2014-07-09 16:04 UTC, Ognyan Tonchev (redstar_)
none Details | Review
client: touch session from client's own context (3.01 KB, patch)
2014-07-09 16:33 UTC, Ognyan Tonchev (redstar_)
none Details | Review

Description Ognyan Tonchev (redstar_) 2014-07-09 14:53:20 UTC
Created attachment 280280 [details]
backtrace

The server deadlocks if it receives TEARDOWN and RTCP RR at the same time. Chack the attached backtrace.
What happens basically is that RTPBin receives RTCP RR from the client which results in a call to gst_rtsp_session_touch () in the server. (pad stream lock taken, waiting for GstRTSPSession's object lock)
At the same time the server is tearing down the pipeline. (GstRTSPSession's object lock taken, waiting for pad stream lock)
Comment 1 Ognyan Tonchev (redstar_) 2014-07-09 14:54:57 UTC
How about touching the session from client's own context? An idle source perhaps?
Comment 2 Ognyan Tonchev (redstar_) 2014-07-09 16:04:36 UTC
Created attachment 280286 [details] [review]
touch session from clients own context

May be something like this?
Comment 3 Ognyan Tonchev (redstar_) 2014-07-09 16:33:06 UTC
Created attachment 280289 [details] [review]
client: touch session from client's own context

proper patch
Comment 4 Wim Taymans 2014-07-09 18:31:24 UTC
Ideally, gst_rtsp_session_filter() should not hold the lock while doing the callback. Either it should use a cookie and restart the callbacks (maybe keeping track of which ones it already did) when something changed after releasing the lock or it should make a copy of the list and work with that outside of the lock.

There are more places where the filter should release the lock to avoid these kinds of deadlocks.
Comment 5 Wim Taymans 2014-07-10 09:38:00 UTC
commit 945c93fde09b461d4b810846e2a9443f915e6507
Author: Wim Taymans <wtaymans@redhat.com>
Date:   Thu Jul 10 11:32:20 2014 +0200

    filter: Release lock in filter functions
    
    Release the object lock before calling the filter functions. We need to
    keep a cookie to detect when the list changed during the filter
    callback. We also keep a hashtable to make sure we only call the filter
    function once for each object in case of concurrent modification.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732950