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 778038 - race in gstpad detected by TSan
race in gstpad detected by TSan
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.10.x
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-01 15:52 UTC by Fabrice Bellet
Modified: 2018-11-03 12:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ThreadSanitizer: data race gstreamer/gst/gstpad.c:5038 in store_sticky_event (98.93 KB, text/plain)
2017-02-01 15:52 UTC, Fabrice Bellet
Details

Description Fabrice Bellet 2017-02-01 15:52:05 UTC
Created attachment 344717 [details]
ThreadSanitizer: data race gstreamer/gst/gstpad.c:5038 in store_sticky_event

This case suggested by ThreadSanitizer happens in gst_pad_query_caps_default() when pad flags are read by GST_PAD_IS_PROXY_CAPS (pad), without lock.
Comment 1 Sebastian Dröge (slomo) 2017-02-01 16:46:18 UTC
The possible problem here is that store_sticky_event() could change the pad flags (EOS flag) while gst_pad_query_caps_default() reads them for another flag (PROXY_CAPS). The latter can only be set once during object creation, not later. The former change at any time. The assumption in gst_pad_query_caps_default() and other places about the pad flags is that they don't change after creation, so no mutex is needed. Which is not true for the EOS, BLOCKED, FLUSHING flags at least.

As access to these is all public API, we have a problem now and can't split them into separate fields anymore. I guess the only solution here would be to make GST_OBJECT_FLAG_SET()/UNSET() use atomic ops (g_atomic_int_compare_and_exchange()) and GST_OBJECT_FLAG_IS_SET() too (g_atomic_int_get()), and also the other macros. And declare that access without those macros is invalid.
Comment 2 Olivier Crête 2017-02-01 18:04:21 UTC
I'm not sure it matters, even if partially updated, the PROXY_CAPS flag won't change.
Comment 3 Sebastian Dröge (slomo) 2017-02-02 10:06:27 UTC
Not specifically in this case, but for https://bugzilla.gnome.org/show_bug.cgi?id=778035 it matters possibly. And it's the same problem.
Comment 4 GStreamer system administrator 2018-11-03 12:39:15 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/218.