From a79e6920cc5df5843453f3c9d258d8224acb4f26 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 15 May 2026 14:15:16 +0300 Subject: [PATCH] sync: fix flaky channel_select_fifo_test race condition After wait_for_pop_subscribers confirms both goroutines registered, the second goroutine may still be in its initial non-blocking try_pop inside channel_select_priv, not yet blocked on sem.wait(). Add a short sleep to let it settle before pushing, ensuring true FIFO ordering. --- vlib/sync/channel_select_fifo_test.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vlib/sync/channel_select_fifo_test.v b/vlib/sync/channel_select_fifo_test.v index 6c8c057f1..9fb06d189 100644 --- a/vlib/sync/channel_select_fifo_test.v +++ b/vlib/sync/channel_select_fifo_test.v @@ -52,6 +52,11 @@ fn test_select_waiters_are_fifo() { wait_for_pop_subscribers(ch, 1) spawn wait_select_once(ch, done, 'second') wait_for_pop_subscribers(ch, 2) + // Let both goroutines settle into sem.wait() inside channel_select. + // Subscriber registration happens before the first non-blocking try, + // so there is a small window where the second goroutine is still in + // its initial try_pop before blocking. + time.sleep(50 * time.millisecond) value := 999 ch.push(&value) assert <-done == 'first:999' -- 2.39.5