Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion js/net/src/lite/datagram-tracks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 5 additions & 0 deletions quest/m0/test-flakes-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
47 changes: 47 additions & 0 deletions quest/m0/test-flakes-2/lite-datagram-end-close.md
Original file line number Diff line number Diff line change
@@ -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.