GNOME Bugzilla – Bug 737690
rtsp-client: deadlock when setting session medias to NULL
Last modified: 2014-10-01 09:37:59 UTC
client_unwatch_session is called with the client lock and sets session medias to NULL with the lock acquired. In my app I'm using RTP session "on-ssrc-stats" where I use gst_rtsp_client_session_filter. So, if a media "on-ssrc-stats" happens while client_unwatch_session has also been called a deadlock occurs. That's because gst_rtsp_client_session_filter is waiting for the client lock and gst_rtsp_media_unprepare is waiting for the pad that emitted "on-ssrc-stats". I can't attach a backtrace since it point to some internal code which wouldn't make much sense here.
Created attachment 287491 [details] [review] set session media to NULL without the client lock This patch fixes the problem by calling gst_rtsp_session_filter (sess, filter_session_media, client); inside cleanup_session where client lock is not acquired. This also seems to solve other bugs and lots of assertion critical warnings (in a stress test with thousands of connection/reconnections).
Talked to early. Just hit a different deadlock before click the send button.
My new deadlock mentioned in comment 2 seems unrelated (just got much further than without the patch). Patch from comment 1 should still be valid.
By the way, "on-ssrc-stats" is something I added with patch from bug 728918, but for the purpose of this bug it has exactly the same effect as "on-ssrc-active" (it is emitted from the same place).
Created attachment 287492 [details] [review] set session media to NULL without the client lock Same patch with comment formatting fixup.
Awesome work Aleix! :)
Wim approves it. Merging it.
Comment on attachment 287492 [details] [review] set session media to NULL without the client lock Merged
FIXED: http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/commit/?id=6c0c90c9d22a3c969e364d559f0a4174931bd08f