[Bug 727100] New: v4l2bufferpool: Race condition on qbuf/dqbuf in a multithreaded context

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Mar 26 08:52:47 PDT 2014


https://bugzilla.gnome.org/show_bug.cgi?id=727100
  GStreamer | gst-plugins-good | 1.2.3

           Summary: v4l2bufferpool: Race condition on qbuf/dqbuf in a
                    multithreaded context
    Classification: Platform
           Product: GStreamer
           Version: 1.2.3
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: andreea.fulger at parrot.com
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


Created an attachment (id=273006)
 View: https://bugzilla.gnome.org/attachment.cgi?id=273006
 Review: https://bugzilla.gnome.org/review?bug=727100&attachment=273006

Protects some of the pool's variables in case of a multithread access to
qbuf/dqbuf

There is currently no protection in v4l2bufferpool for concurrent access to a
bufferpool on qbuf / dqbuf.

A race condition might occur when a v4l2 element shares it's output bufferpool
with a multithreaded downstream element. When the downstream element releases
the buffer back into the v4l2 bufferpool (thus making a call to qbuf), the v4l2
element might acquire a buffer (thus making a call to dqbuf). If the ioctl on
DQBUF returns faster than the one on QBUF, the pool's buffers are not updated
and thus the output buffer might be NULL, as we can see below:

Thread v4l2 element         : GstV4l2scale:using pool alloc
Thread v4l2 element         : GstV4l2BufferPool:acquire
Thread v4l2 element         : GstV4l2BufferPool:doing DQBUF
Thread downstream element   : GstV4l2BufferPool:release buffer 0x73c776f0
Thread downstream element   : GstV4l2BufferPool:enqueue buffer 0x73c776f0,
index:3, queued:0, flags:00000003 mem:0x6dbbf000 used:663552
Thread downstream element   : GstV4l2BufferPool:doing QBUF
Thread v4l2 element         : GstV4l2BufferPool:No free buffer found in the
pool at index 3.

Here is a patch that corrects this race condition.

-- 
Configure bugmail: https://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