[Bug 775014] v4l2src buffer leak, race condition sending EOS from another thread

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu Nov 24 15:58:03 UTC 2016


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

--- Comment #6 from Philipp Zabel <p.zabel at pengutronix.de> ---
gst_base_src_send_event (GST_EVENT_EOS) calls gst_base_src_activate_pool
(FALSE) -> gst_buffer_pool_set_active (FALSE), which calls do_set_flushing
(TRUE) and potentially do_stop () in that order and only then sets priv->active
= FALSE.
I think gstbufferpool priv->active can never be FALSE unless pool->flushing is
already set to 1, so moving that assertion after the GST_FLOW_FLUSHING return
should not be a problem. It should never be hit.

Here is the relevant part of a log in the error case:

First EOS is sent from a thread:

0:00:52.897536007  2797 0x552bbe00 DEBUG       GST_ELEMENT_PADS
gstelement.c:1592:gst_element_send_event: send eos event on element v4l2src0
0:00:52.897605007  2797 0x552bbe00 DEBUG                basesrc
gstbasesrc.c:1752:gst_base_src_send_event:<v4l2src0> handling event 0x7320bdb8
eos event: 0x7320bdb8, time 99:99:99.999999999, seq-num 2776, (NULL)
0:00:52.897678007  2797 0x552bbe00 DEBUG                basesrc
gstbasesrc.c:1839:gst_base_src_send_event:<v4l2src0> EOS marked, calling unlock
0:00:52.897729007  2797 0x552bbe00 DEBUG                basesrc
gstbasesrc.c:3027:gst_base_src_activate_pool:<v4l2src0>
gst_base_src_activate_pool pool=0x5538dd38 active=0
0:00:52.897792673  2797 0x552bbe00 LOG               bufferpool
gstbufferpool.c:473:gst_buffer_pool_set_active:<v4l2src0:pool:src> active 0
0:00:52.897845340  2797 0x552bbe00 DEBUG         v4l2bufferpool
gstv4l2bufferpool.c:933:gst_v4l2_buffer_pool_flush_start:<v4l2src0:pool:src>
start flushing
0:00:52.897901340  2797 0x552bbe00 LOG               bufferpool
gstbufferpool.c:505:gst_buffer_pool_set_active:<v4l2src0:pool:src> outstanding
buffers 1
0:00:52.897962673  2797 0x552bbe00 DEBUG                basesrc
gstbasesrc.c:1849:gst_base_src_send_event:<v4l2src0> unlock called, waiting for
LIVE_LOCK

then ->alloc() returns with a buffer and gst_v4l2src_create continues:

0:00:52.896312673  2797 0x74701f80 DEBUG               GST_POLL
gstpoll.c:1066:gst_poll_fd_has_error: 0x55389050: fd (fd:22, idx:1) 0
0:00:52.898107673  2797 0x74701f80 LOG           v4l2bufferpool
gstv4l2bufferpool.c:1162:gst_v4l2_buffer_pool_dqbuf:<v4l2src0:pool:src>
dequeueing a buffer
0:00:52.898275340  2797 0x74701f80 LOG            v4l2allocator
gstv4l2allocator.c:1331:gst_v4l2_allocator_dqbuf:<v4l2src0:pool:src:allocator>
dequeued buffer 4 (flags 0x2005)
0:00:52.898386673  2797 0x74701f80 DEBUG          v4l2allocator
gstv4l2allocator.c:1335:gst_v4l2_allocator_dqbuf:<v4l2src0:pool:src:allocator>
driver pretends buffer is queued even if dequeue succeeded
0:00:52.898482673  2797 0x74701f80 LOG           v4l2bufferpool
gstv4l2bufferpool.c:1194:gst_v4l2_buffer_pool_dqbuf:<v4l2src0:pool:src>
dequeued buffer 0x7320a850 seq:14 (ix=4), mem 0x5537f568 used 829440, plane=0,
flags 00002001, ts 1:04:25.730204000, pool-queued=4, buffer=0x7320a850
0:00:52.898690673  2797 0x74701f80 DEBUG         v4l2bufferpool
gstv4l2bufferpool.c:1722:gst_v4l2_buffer_pool_process:<v4l2src0:pool:src>
process buffer 0x726d2c5c

** (videosrc_dualstream_scaler:2797): CRITICAL **:
gst_v4l2_buffer_pool_process: assertion 'gst_buffer_pool_is_active (bpool)'
failed
0:00:52.902650007  2797 0x74701f80 DEBUG                v4l2src
gstv4l2src.c:912:gst_v4l2src_create:<v4l2src0> error processing buffer -5
(error)

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