GNOME Bugzilla – Bug 53071
mainloop-test broken
Last modified: 2011-02-18 15:47:43 UTC
The mainloop test has one definite problem and one maybe problem. The definite problem is that given suitably unfair thread scheduling, the first crawler could run before any adder and cause a crash by calling "g_random_int_range (0, context_array->len)" when context_array->len is 0. (This happens maybe every 10th time I try to run it on Darwin.) The maybe problem is that on Darwin, it always crashes in g_source_destroy inside remove_crawler after a while, apparently destroying an already- destroyed source. (I don't know for sure that this is really the test program or glib's fault though, as opposed to maybe a Darwin pthreads bug.)
Checking in a fix to the definite problem. However, I also see the crashes (occasionally); they aren't darwin-specific. Debugging them is not proving easy, and is providing a demonstration that test cases of the nature of "write something really complicated and see if it works" have drawbacks.
Just checked in some fixes to CVS for mainloop-test race condition and another bug in mainloop-test that seems to fix the problem for me. (Fingers crossed.) The problem with the sources is that a crawler could run and destroy itself before it was added to the crawler array.