Skip to content

test: Potentially fix a race in thread-pool-slow test

Philip Withnall requested to merge pwithnall/glib:thread-pool-fix-test into main

It’s failed on a CI machine (https://gitlab.gnome.org/GNOME/glib/-/jobs/2006694) with log:

[unused] => pushed 100 threads onto the idle pool
[unused] stopping unused threads
[unused] waiting ONE second for threads to die
[unused] waiting ONE second for threads to die
[unused] waiting ONE second for threads to die
[unused] waiting ONE second for threads to die
[unused] waiting ONE second for threads to die
[unused] stopped idle threads, 9 remain
Bail out! GLib:ERROR:../glib/tests/thread-pool-slow.c:113:test_thread_stop_unused: assertion failed (g_thread_pool_get_num_unused_threads () == 0): (9 == 0)

I can’t reproduce this locally, but it’s possible that it failed because a one second wait was not enough to enqueue all the jobs (on a heavily loaded machine), and hence some jobs spawned thread pool threads after calling g_thread_pool_stop_unused_threads(), leading to the assertion failure.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Merge request reports