diff --git a/js/net/src/lite/datagram-tracks.test.ts b/js/net/src/lite/datagram-tracks.test.ts index a79af11067f..2cbbbc51e42 100644 --- a/js/net/src/lite/datagram-tracks.test.ts +++ b/js/net/src/lite/datagram-tracks.test.ts @@ -450,8 +450,11 @@ for (const alpn of [ALPN_05, ALPN_06, ALPN_07_WIP]) { // A track's end waits a host task for the datagrams received with it. A session close in // between finishes the track rather than cutting it off: the publisher already ended it. +// Quarantined: under load the subscriber sometimes hasn't read the FIN before the close, so the +// fixed microtask drain aborts the track instead. Investigation: +// quest/m0/test-flakes-2/lite-datagram-end-close.md. for (const alpn of [ALPN_05, ALPN_06, ALPN_07_WIP]) { - test(`${alpn}: a session close right after a datagram track's end keeps the end`, async () => { + test.skip(`${alpn}: a session close right after a datagram track's end keeps the end`, async () => { const source = new Origin(); const publication = source.route(path, { hidden: true }); const datagrams = publication.broadcast.createDatagrams("audio"); diff --git a/quest/m0/test-flakes-2/README.md b/quest/m0/test-flakes-2/README.md index 9475129619c..1fd65da4554 100644 --- a/quest/m0/test-flakes-2/README.md +++ b/quest/m0/test-flakes-2/README.md @@ -101,6 +101,10 @@ tests' shared locked-memory budget, one child each. On 2026-11-06, moq-ffi's concurrent-ready test, quarantined here instead of in the unrelated [moq-dev/moq#7981](https://github.com/moq-dev/moq/pull/7981). +Added 2026-11-06 (CI fix run): `js/net`'s lite datagram-end close test, which +fails on loaded `main` too and was quarantined in +[moq-dev/moq#8007](https://github.com/moq-dev/moq/pull/8007), one child. + Public API: none. Wire: none. ## Required @@ -116,3 +120,4 @@ Public API: none. Wire: none. - [The Python audio playout-delay test reads its frames](/quest/m0/test-flakes-2/audio-playout-delay.md) - `test_audio_consumer_reports_its_playout_delay` stops timing out on its first read in the merge queue - [io_uring tests fit the shared locked-memory budget](/quest/m0/test-flakes-2/uring-memlock.md) - concurrent moq-relay and moq-uring test runs stop exhausting the user's `RLIMIT_MEMLOCK`, fixed at the cause rather than by raising the limit - [The FFI concurrent-ready test wakes both calls under load](/quest/m0/test-flakes-2/ffi-concurrent-ready.md) - `concurrent_ready_calls_all_wake` stops stalling its reader drain under load and is re-enabled +- [A close after a datagram track's end keeps the end under load](/quest/m0/test-flakes-2/lite-datagram-end-close.md) - `js/net`'s lite datagram-end close test waits for the FIN to arrive instead of a microtask count, then is re-enabled diff --git a/quest/m0/test-flakes-2/lite-datagram-end-close.md b/quest/m0/test-flakes-2/lite-datagram-end-close.md new file mode 100644 index 00000000000..40ba02e6ce5 --- /dev/null +++ b/quest/m0/test-flakes-2/lite-datagram-end-close.md @@ -0,0 +1,47 @@ +# [S] A close after a datagram track's end keeps the end under load + +## Goal + +`a session close right after a datagram track's end keeps the end` in +`js/net/src/lite/datagram-tracks.test.ts` passes reliably in loaded runs, fixed +at its cause under the [epic](/quest/m0/test-flakes-2/README.md)'s rules, and +its `test.skip` is removed. Done when the PR explains the race and shows the +loaded run that reproduced it now passing. + +## Plan + +Added 2026-11-06 (maintainer's standing rule that flakes join this epic, CI fix +run on [moq-dev/moq#8007](https://github.com/moq-dev/moq/pull/8007)). Check +`test rs`/`test js` failed the lite-06 case once, and the PR does not touch the +test or the datagram paths. Quarantined with every assertion kept, since the +same test fails on unchanged `main`. + +Reproduced on both trees by running the file beside one busy loop per core +(4 cores): `main` failed 4 of 8 runs, the PR head 7 of 8, always the lite-06 +case, and always as `Session: remote error: 0` from `recv()`. Instrumenting +`Subscriber.close` showed the datagram entry's `ended` was still unset when the +close ran: the subscriber had not read the DATAGRAMS_INFO FIN within the test's +`for (let i = 0; i < 1000; i++) await Promise.resolve()` drain. The test comment +assumes the mock delivers the end in microtasks within the same host task, but +under load part of the publisher's `track.recv() -> sender.close() -> +stream.writer.close()` chain, or the subscriber's `opened.reader.done()`, needs +a host task, so the abort wins. + +`Subscriber.close` already finishes a datagram producer whose track `ended` and +only aborts the rest, and Rust's `end_datagrams` moves an ended track out of the +abortable map. So the intended behavior is clear; the test's fixed microtask +drain is not a reliable way to observe that the FIN arrived. Lead, unverified: +wait for an observable of the receipt (for example a package-internal hook set +where `route.ended = true` runs, like the existing `hooks`), then close while the +end is still deferred by `#datagramsRouted`'s `yieldNow()`, which is the window +the test means to cover. Do not raise the microtask count or add a retry. + +Reproduce first: run `js/net/src/lite/datagram-tracks.test.ts` beside one busy +loop per core and keep a failing run's output. + +Public API: none. Wire: none. + +## Waiting + +- moq-dev/moq: capture a failing loaded run of the file with logs before + choosing the observable to wait on, then remove the skip.