Skip to content

Commit f4e6271

Browse files
committed
test(qwp): join the I/O worker before asserting it dead in blocked-send close test
close() returns when the worker counts shutdownLatch down inside ioLoop's finally -- before the worker's exit tail and actual thread termination -- so Thread.isAlive() can be observably true for a scheduling beat after close() returns (linux-x64 failure in build 252736). Quiescence is the latch plus the cleanup-before-countdown ordering (already asserted), not thread death; every sibling test already uses join-then-assert. Reproduced by sleeping 200ms after the countdown: the old assert fails exactly like CI; the joined assert passes under the same window.
1 parent fee9903 commit f4e6271

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

core/src/test/java/io/questdb/client/test/cutlass/qwp/client/sf/cursor/CursorWebSocketSendLoopBlockedSendCloseTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,14 @@ public void testCloseBreaksBlockedSendBeforeJoiningWorker() throws Exception {
9595

9696
Thread ioThread = client.sendThread.get();
9797
Assert.assertNotNull(ioThread);
98-
Assert.assertFalse("I/O worker must be dead when close returns", ioThread.isAlive());
98+
// close() returns when the worker counts shutdownLatch down --
99+
// the worker's last action before its exit tail -- so the
100+
// thread can be observably alive for a scheduling beat after
101+
// close() returns. Quiescence is the latch plus the cleanup
102+
// asserts below (cleanup runs before the countdown), not
103+
// thread death: join briefly instead of asserting the race.
104+
ioThread.join(TimeUnit.SECONDS.toMillis(5));
105+
Assert.assertFalse("I/O worker did not exit after close returned", ioThread.isAlive());
99106
Assert.assertEquals("full client cleanup must run exactly once", 1, client.cleanupCount.get());
100107
Assert.assertEquals("the I/O worker must own cleanup before publishing exit",
101108
ioThread, client.cleanupThread.get());

0 commit comments

Comments
 (0)