[Bug 792595] New: "Race" when (de)activating pads

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed Jan 17 10:06:18 UTC 2018


https://bugzilla.gnome.org/show_bug.cgi?id=792595

            Bug ID: 792595
           Summary: "Race" when (de)activating pads
    Classification: Platform
           Product: GStreamer
           Version: git master
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: bilboed at bilboed.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Currently the following scenario can happen.

* Thread 1 (from downstream elements) wants to reconfigure the scheduling mode
of an upstream element (such as typefind)
* Thread 2 (from the application or higher-level element) wants to deactivate
the scheduling of that element.

The following "race" happens:
* T2 calls gst_pad_set_active(pad, FALSE)
** T2 calls activate_mode_internal(pad, ..., FALSE)
** T2 pad was currently active, it eventually calls pre_activate(pad,
GST_PAD_MODE_NONE), which sets in_activation to TRUE and GST_PAD_MODE(pad) to
GST_PAD_MODE_NONE
** T2 calls the actual activation function
* T1 calls gst_pad_activate_mode(pad, ..., TRUE)
** T2 calls activate_mode_internal(pad, ...., TRUE)
** T2 has GST_PAD_MODE_NONE, so carries on to call pre_activate
** T2 in pre_activate sees that in_activation is TRUE, so waits for the other
thread to finish (and set in_activation to FALSE)
* T2 finished calling the actual activation function and calls post_activate
** T2 set in_activation to FALSE and resumes succesfully, i.e. telling the
caller that the pad *is* deactivated
* T1 can resume activation and actually activates the pad

=> T2 assumes the pad is deactivated .... but it's not. (Note that the exact
opposite could also happen).

Not entirely sure how this could be solved though.

-- 
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