GNOME Bugzilla – Bug 766063
basesrc: deadlock between src_loop and set_playing
Last modified: 2016-05-12 14:47:21 UTC
I have found a deadlock (with live_lock) in GstBaseSrc for NiceSrc instances. We have 2 threads: thread_loop: where gst_base_src_loop task runs. thread_app: performs the state change of the pipeline. The deadlock takes places with this race condition: 1 - [thread_loop] gst_base_src_get_range is locked waiting for buffers in bclass->create [1] (with live_lock locked [2]). 2 - [thread_app] bclass->create is released in gst_base_src_set_playing by bclass->unlock [3]. 3 - [thread_loop] locks live_lock again [2] and is blocked by bclass->create [1]. 4 - [thread_app] tries to lock live_lock [4], but it is already locked by [thread_loop]. 5 - thread_loop] bclass->create [1] never returns. Refs [1] https://github.com/Kurento/gstreamer/blob/0fb3a083ce04551fbdba7a94f0ac5612515bda67/libs/gst/base/gstbasesrc.c#L2460 [2] https://github.com/Kurento/gstreamer/blob/0fb3a083ce04551fbdba7a94f0ac5612515bda67/libs/gst/base/gstbasesrc.c#L2709 [3] https://github.com/Kurento/gstreamer/blob/0fb3a083ce04551fbdba7a94f0ac5612515bda67/libs/gst/base/gstbasesrc.c#L3646 [4] https://github.com/Kurento/gstreamer/blob/0fb3a083ce04551fbdba7a94f0ac5612515bda67/libs/gst/base/gstbasesrc.c#L3653
It seems that the problem is in the implementation of NiceSrc because it does not implement unlock_stop() virtual method.
Hello, the deadlock is caused because NiceSrc does not implement virtual GstBaseSrc functions properly. I opened a bug in libnice phabricator: https://phabricator.freedesktop.org/T7423 I am closing this bug, sorry for the inconvenience.