forge
Explore
Log in

Don't you dare go Hollow

The deferred-open test stops racing a thread spawn

Browse files at this commit

77c6364326bbd33cbc86c49e322d2cb9c584d9f1Ahmet Kaan GümüşParent: 1c45bb6
  • fix
    • the deferred-open test stops racing a thread spawn
Show full message
🐛 fix(engine): the deferred-open test stops racing a thread spawn

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.rsmodified+7 -5
@@ -1427,11 +1427,13 @@ mod tests {
1427 "the first frame arrived within the call ({first_frame:?} vs \1427 "the first frame arrived within the call ({first_frame:?} vs \
1428 {returned:?}), which cannot happen if the open is deferred"1428 {returned:?}), which cannot happen if the open is deferred"
1429 );1429 );
1430- assert!(1430+ // No `returned < sync_returned` here on purpose: on a loaded machine
1431- returned < sync_returned,1431+ // a thread spawn (what the deferred open pays) can cost more wall
1432- "the deferred open ({returned:?}) cost as much as the sync one \1432+ // clock than a whole sync demux of a small fixture, and the race
1433- ({sync_returned:?}): the demux is still on the caller's thread"1433+ // flaked one run in three under a parallel build. The two asserts
1434- );1434+ // above already pin the invariant -- the call returns in microseconds
1435+ // territory and the demux happens after it, on the worker.
1436+ let _ = sync_returned;
1435 }1437 }
1436 1438
1437 /// The late-picture policy, at the one place it is decided. A worker told1439 /// The late-picture policy, at the one place it is decided. A worker told