Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

relay: the CLOSE-during-mint test synchronises on a 50 ms sleep and can fail under load

Aperta
#963 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@chappie-daemon ci sta già lavorando.

Dal 25/10/2026.

  • #987 di @chappie-daemon — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
rust, typescript
Ambito
backend, testing

Direzione di ricerca

Start with crates/nostream-relay/tests/handlers.rs:1135 and inspect the test's CLOSE handling and gate release; then read testing.rs for the existing gate observables and Connection::read_in_flight. Replace the fixed 50 ms delay with a bounded wait for the abort signal or cleared in-flight read. Done when release is ordered after the abort, the timeout reports a clear failure, and the test no longer relies on sleep; pull request #987 is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug factory rewrite rust

a_close_during_the_invite_mint_leaves_the_event_but_not_the_read (crates/nostream-relay/tests/handlers.rs:1135, added in #962) synchronises the CLOSE against the invite mint with a fixed sleep:

gate.add_permits(1);

...is preceded only by tokio::time::sleep(Duration::from_millis(50)) after ["CLOSE","invite"] is sent. Nothing confirms the server has processed the CLOSE — i.e. that unsubscribe::handle has run abort_read and set the in-flight read's cancellation — before the gate releases the mint.

Failure mode: a false failure, not a false pass. If a busy runner delays the CLOSE handler past the sleep, the mint resumes first, the handler reaches fetch_and_send with the cancellation not yet set, and the test then observes the stored EVENT and the EOSE it asserts must not arrive. The fix is correct and the test goes red anyway. The window is small (50 ms against a local in-memory store) and the test passed in CI on #962, so this is a flake risk rather than a live defect.

Suggested fix. Wait for a server-side signal instead of for elapsed time. The crate already has the passive half — Connection::read_in_flight(id) is observable — so the options are:

  1. Poll fixture.connection(id).read_in_flight("invite") == false (the abort removes the entry) before gate.add_permits(1), with a bounded timeout that fails with a clear message rather than hanging.
  2. Add an observable for "a read was aborted" on the test double, mirroring the existing gate_reads / gate_reads_per_item / gate_creates idiom in testing.rs, and await it.

Either way the release becomes ordered after the abort by construction, and the 50 ms sleep goes.

Residual risk worth stating in the fix: the CLOSE's handler runs in a spawned task (relay.rs spawns each client message independently), so a wait on server-side state is the only ordering that does not depend on scheduling. That is also the mechanism behind #958, which is a separate pre-existing defect and not this test's problem.

Found by the Greptile review on #962 (P2). Recorded rather than fixed there, per the rule that a bot finding which is not a showstopper becomes its own issue instead of blocking the merge that revealed it.

Lingua principale
TypeScript
Stelle
829
Fork
234
Merge medio
17h 6m
PR unite (30g)
92

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cameri/nostream

Tutte le issue di cameri/nostream

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.