GNOME Bugzilla – Bug 725503
tests: unix-stream test just failed
Last modified: 2017-12-19 09:36:42 UTC
# random seed: R02S991af33424e7e434b09634adb6f7f22b # Start of unix-streams tests (/home/desrt/code/glib/gio/tests/.libs/lt-unix-streams:25750): GLib-CRITICAL **: g_source_set_ready_time: assertion 'source->ref_count > 0' failed ok 1 /unix-streams/basic PASS: unix-streams 1 /unix-streams/basic ../../tap-test: line 5: 25750 Trace/breakpoint trap $1 -k --tap # GLib-FATAL-CRITICAL: g_source_set_ready_time: assertion 'source->ref_count > 0' failed ERROR: unix-streams - missing test plan ERROR: unix-streams - exited with status 133 (terminated by signal 5?)
Looks like we can have a race between a cancellable source being destroyed and cancellable_source_cancelled() being called. The cancellable doesn't take a ref on the source (and indeed it shouldn't) but then: g_signal_connect (cancellable, "cancelled", G_CALLBACK (cancellable_source_cancelled), source); and static void cancellable_source_cancelled (GCancellable *cancellable, gpointer user_data) { GSource *source = user_data; if (!g_source_is_destroyed (source)) g_source_set_ready_time (source, 0); } which means that if the cancellable is cancelled in one thread, and the source is destroyed in another (between the check for _is_destroyed() and the _set_ready_time() call) then we will call _set_ready_time() on a destroyed source.
The code has changed slightly since this race was first reported, but the race still exists. Duping to bug #791754, because it has a backtrace. *** This bug has been marked as a duplicate of bug 791754 ***