partyserver: with hibernation off, a closing socket removes a newer connection with the same id from getConnections(), so that client stops receiving broadcasts
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend
Direzione di ricerca
Inizia da InMemoryConnectionManager.accept e removeConnection, dove l’issue identifica la voce della map e il listener di chiusura/errore. Controlla i test per la sostituzione delle connessioni e gli eventi di chiusura ritardati, poi verifica che la chiusura di un socket precedente lasci disponibile la connessione più recente tramite getConnections(). Il lavoro è completato quando la connessione sostitutiva continua a ricevere broadcast dopo la chiusura del socket precedente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
InMemoryConnectionManager.accept stores connections in a Map keyed by connection.id. Its close/error listener runs this.#connections.delete(connection.id) without checking that the entry is still that connection.
y-partyserver's YProvider sends one _pk (from connectionId, or nanoid(10) once per provider) on every reconnect. So a client that reconnects while the server still holds its old socket replaces the map entry. When the old socket's close arrives later, the delete removes the new, live connection. From then on getConnections() never yields it. The client keeps sending and the server keeps applying its updates, but no broadcast reaches it: with y-partyserver that is every document update and every awareness change from the other peers. Nothing tells the client, and the provider has no watchdog for a silent socket, so it stays deaf until it reconnects for some other reason.
Repro (partyserver 0.5.10, y-partyserver 2.2.0, wrangler 4.159.0, compatibility date 2026-11-01, hibernate: false, via unstable_startWorker). A and B are YProviders in one room:
- Open a raw WebSocket to the room with
?_pk=<A.provider.id>. It stands in for an old socket the server has not seen die yet. - Connect A, then terminate the raw socket and wait 1.5 s.
- A's updates still reach B. But within 3 s, none of these reach A: B's updates, B's awareness change, and the updates of a newcomer C.
The result is the same when the raw socket opens after A. Without the raw socket, all of these checks pass.
Suggested fix: in removeConnection, delete only when this.#connections.get(connection.id) === connection. The older socket then leaves the map as soon as it is replaced, which fits: it is the stale one.
- Lingua principale
- TypeScript
- Stelle
- 1.3k
- Fork
- 84
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cloudflare/partykit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
cloudflare/partykit#429 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloudflare/partykit#428 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
cloudflare/partykit#425 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
cloudflare/partykit#424 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
cloudflare/partykit#423 ·
Tutte le issue di cloudflare/partykit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
mcp: create_app refuses the Assistant Inbox spec as 'looks like an API key' (nesting deeper than 8)Apertaagent:claude agent:ready dogfood type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
opennextjs/opennextjs-cloudflare#1485 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement lane: fast tier: should-stable
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
unicef/adt-studio#1078 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
WenyuChiou/agent-board#1283 ·
I maintainer di solito rispondono entro 1 giorno