From 77c6364326bbd33cbc86c49e322d2cb9c584d9f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 20 Aug 2026 02:42:09 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(engine):=20the=20deferred-op?= =?UTF-8?q?en=20test=20stops=20racing=20a=20thread=20spawn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Under a loaded machine the spawn a deferred open pays can cost more wall clock than a sync demux of a small fixture; the remaining two asserts pin the deferral invariant without the race. Flaked 1-in-3 during parallel builds. --- crates/engine/src/decode.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/decode.rs b/crates/engine/src/decode.rs index f1a9aca..887afeb 100644 --- a/crates/engine/src/decode.rs +++ b/crates/engine/src/decode.rs @@ -1427,11 +1427,13 @@ mod tests { "the first frame arrived within the call ({first_frame:?} vs \ {returned:?}), which cannot happen if the open is deferred" ); - assert!( - returned < sync_returned, - "the deferred open ({returned:?}) cost as much as the sync one \ - ({sync_returned:?}): the demux is still on the caller's thread" - ); + // No `returned < sync_returned` here on purpose: on a loaded machine + // a thread spawn (what the deferred open pays) can cost more wall + // clock than a whole sync demux of a small fixture, and the race + // flaked one run in three under a parallel build. The two asserts + // above already pin the invariant -- the call returns in microseconds + // territory and the demux happens after it, on the worker. + let _ = sync_returned; } /// The late-picture policy, at the one place it is decided. A worker told