[gstreamer-bugs] [Bug 593983] New: dead lock in rtp session
GStreamer (bugzilla.gnome.org)
bugzilla at gnome.org
Wed Sep 2 19:50:10 PDT 2009
http://bugzilla.gnome.org/show_bug.cgi?id=593983
Summary: dead lock in rtp session
Classification: Desktop
Product: GStreamer
Version: git
OS/Version: Linux
Status: UNCONFIRMED
Severity: critical
Priority: Normal
Component: gst-plugins-bad
AssignedTo: gstreamer-bugs at lists.sourceforge.net
ReportedBy: csxnju at sogou.com
QAContact: gstreamer-bugs at lists.sourceforge.net
GNOME target: ---
GNOME version: ---
--- Comment #0 from ric <csxnju at sogou.com> 2009-09-03 02:50:05 UTC ---
There is dead lock in gstrtpsession.c and rtpsession.c.
This will influence five thread, two rtcp receiving threads, two rtcp sending
threads and one control thread.
The dead lock will occur under this situation,
rtcp_thread() --> GST_RTP_SESSION_LOCK (rtpsession) -->
rtp_session_next_timeout (rtpsession->priv->session, current_time) -->
RTP_SESSION_LOCK (sess)
or
rtcp_thread() --> GST_RTP_SESSION_LOCK (rtpsession) --> rtp_session_on_timeout
(rtpsession->priv->session, current_time, ntpnstime) --> RTP_SESSION_LOCK
(sess)
But the receiving sender's rtcp thread do something like this,
rtp_session_process_rtcp() --> RTP_SESSION_LOCK (sess) -->
rtp_session_process_bye (sess, &packet, &arrival) -->
sess->callbacks.reconsider (sess, sess->reconsider_user_data)
[gst_rtp_session_reconsider (RTPSession * sess, gpointer user_data) ] -->
GST_RTP_SESSION_LOCK (rtpsession)
see, one thread lock GST_RTP_SESSION_LOCK (rtpsession) first, then try to lock
RTP_SESSION_LOCK (sess); but another thread lock RTP_SESSION_LOCK (sess) first,
then try to lock GST_RTP_SESSION_LOCK (rtpsession); this will causes dead lock
sooner or later. And I have encountered such a situation.
The solutions,
1. This is a simple one. Add another lock in "struct _RTPSession" called
inter_lock. Above five thread can't acquire their desired lock unless they
acquire this inter_lock first. This will change the following function,
rtcp_thread(), stop_rtcp_thread(), rtp_session_init(), rtp_session_finalize(),
rtp_session_process_rtcp()
2. This is a theoretic one. Change the calling logic of this five threads. This
is a big change and it needs more careful thinkings. I have not done this.
Tks.
--
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the Gstreamer-bugs
mailing list