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 766063 - basesrc: deadlock between src_loop and set_playing
basesrc: deadlock between src_loop and set_playing
Status: RESOLVED NOTGNOME
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.8.2
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-05-06 14:02 UTC by Miguel París Díaz
Modified: 2016-05-12 14:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Miguel París Díaz 2016-05-06 14:02:45 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
Comment 1 Miguel París Díaz 2016-05-09 18:01:47 UTC
It seems that the problem is in the implementation of NiceSrc because it does not implement unlock_stop() virtual method.
Comment 2 Miguel París Díaz 2016-05-12 14:47:21 UTC
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.