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 311496 - Race condition in optimal scheduler
Race condition in optimal scheduler
Status: RESOLVED DUPLICATE of bug 166020
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.8.x
Other Linux
: Normal critical
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-07-25 15:12 UTC by Josef Zlomek
Modified: 2005-08-29 15:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Possible patch (1.51 KB, patch)
2005-07-25 15:15 UTC, Josef Zlomek
none Details | Review
Better patch (1.60 KB, patch)
2005-07-27 15:19 UTC, Josef Zlomek
none Details | Review

Description Josef Zlomek 2005-07-25 15:12:09 UTC
When the gstreamer application is multithreaded and the threads begins with
queue, the queue between the threads is used by both threads. In
gstoptimalscheduler in function schedule_group near line 1233, the reference
count of group->entry, which is a queue in my application, is increased and
later decreased. But because the queue is used from two threads, race condition
occurs while increasing/decreasing reference counts. The result is that the
reference count gets decreased to 0 and the queue is destroyed, which breaks the
pipe and the application halts.
On SMP machine, this bug appears in 5 minutes.

The patch, which will be uploaded in a minute, fixes this by surrounding the
refcount increase/decrease by mutex lock and unlock. This might not be the
correct solution but it helps (the application with the patched gstreamer did
not halt yet).
Comment 1 Josef Zlomek 2005-07-25 15:15:12 UTC
Created attachment 49723 [details] [review]
Possible patch
Comment 2 Josef Zlomek 2005-07-27 15:19:27 UTC
Created attachment 49845 [details] [review]
Better patch

This patch is much better (but there still might be a better fix). Some
refs/unrefs happen in other places of scheduler too so when all refs/unrefs are
protected by a mutex less race conditions happen.
Comment 3 Ronald Bultje 2005-07-27 16:21:18 UTC
I considering dupping this to #166020, which is about refcounting
thread-unsafety in glib (and which was fixed for the yet-to-be-released
glib-2.8). We indeed are aware of the issue, but we'd rather not take locks to
workaround bugs that are not our own...
Comment 4 Andy Wingo 2005-08-02 14:02:09 UTC
Definitely a dup to #166020. Should work better with GLib >= 2.7.3. Note that
GStreamer 0.8's threadsafety is poor; consider moving to 0.9.

*** This bug has been marked as a duplicate of 166020 ***