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 326576 - possible race in set_state
possible race in set_state
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-11 10:40 UTC by Wim Taymans
Modified: 2006-02-08 17:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.54 KB, patch)
2006-01-11 10:42 UTC, Wim Taymans
reviewed Details | Review

Description Wim Taymans 2006-01-11 10:40:31 UTC
after performing an async state change, the _STATE_RETURN value is updated after taking the object lock protecting that variable. The problem is that there is a window where the state could be commited asynchronously before we update the value in which case we override the STATE_RETURN with a wrong value. A _get_state would then wait forever.
Comment 1 Wim Taymans 2006-01-11 10:42:33 UTC
Created attachment 57150 [details] [review]
proposed patch

This patch sets the _STATE_RETURN to ASYNC before performing the state change to mark that we are busy. We have to be careful that we don't override the old RETURN_VALUE if there is no state change to be performed.
Comment 2 Andy Wingo 2006-01-17 11:02:50 UTC
This sounds about right but it scares me a bit. Is there any way you could implement a test suite? Perhaps with a fake element that changes state async,  spawning a thread that immediately commits the state, changing state 100 times or so. Dunno though -- "Use your best judgement" ;)
Comment 3 Wim Taymans 2006-02-02 14:01:34 UTC
commited and closed, it's theoretically more correct and a testcase other than adding g_usleep() in places is not possible.