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 764865 - audiosrc, audiosink: race in gstaudiosrc audioringbuffer thread
audiosrc, audiosink: race in gstaudiosrc audioringbuffer thread
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.8.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-10 20:36 UTC by Fabrice Bellet
Modified: 2016-04-11 11:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
audio: Fix a race with the audioringbuffer thread (2.66 KB, patch)
2016-04-10 20:36 UTC, Fabrice Bellet
none Details | Review
audio: Fix a race with the audioringbuffer thread (2.81 KB, patch)
2016-04-11 11:39 UTC, Fabrice Bellet
committed Details | Review

Description Fabrice Bellet 2016-04-10 20:36:40 UTC
Created attachment 325684 [details] [review]
audio: Fix a race with the audioringbuffer thread

I think I found a race problem occurring in some rare situations, in the audioringbuffer thread, when the src->thread variable is used in the audioringbuffer thread _before_ it is updated in the parent thread with src->thread = g_thread_try_new(...). The same situation may probably happen in sink too, even if I only observed the problem in the gstaudiosrc myself.
Comment 1 Jan Schmidt 2016-04-11 06:38:47 UTC
A simpler solution is just to use g_thread_self() in the child thread to get the GThread directly.
Comment 2 Fabrice Bellet 2016-04-11 11:39:46 UTC
Created attachment 325718 [details] [review]
audio: Fix a race with the audioringbuffer thread

Yes, thanks for this suggestion: updated patch, using g_thread_self() instead of the variable set by the parent thread.
Comment 3 Jan Schmidt 2016-04-11 11:45:19 UTC
Thanks! Pushed:

commit bfcd0737b7acd8fa5f055f49641fa3101bfb76de
Author: Fabrice Bellet <fabrice@bellet.info>
Date:   Mon Apr 11 11:28:09 2016 +0200

    audio: Fix a race with the audioringbuffer thread
    
    There is a small window of time where the audio ringbuffer thread
    can access the parent thread variable, before it's initialized
    by the parent thread. The patch replaces this variable use by
    g_thread_self().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764865