cluster: registerEntity does not reopen the storage read, so messages read before registration wait for entityMessagePollInterval
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- distributed-systems
Línea de trabajo
Start in packages/effect/src/cluster/Sharding.ts at the registerEntity logic around lines 1928-1937, then trace how storageReadLatch is opened by the poll fiber and how reads reset addresses for unregistered entity types around lines 860-864. Reproduce with persisted messages and no new client message; done means registration triggers an immediate storage reread and the pending handler runs without waiting for entityMessagePollInterval.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
At boot, Sharding starts reading persisted messages as soon as it is built. An entity can only register after that, because registerEntity needs Sharding. When a read finds a message for an entity type that is not registered yet, Sharding resets the address and drops the message from that read ("reset address in the case that the entity is slow to register").
registerEntity then sets the entity manager inside withStorageReadLock, but it does not open storageReadLatch. With no new client message, nothing opens the latch until the poll fiber does, after entityMessagePollInterval (10 s by default). So every persisted message for that entity waits up to 10 s after a restart.
Where (packages/effect/src/cluster/Sharding.ts on main; same shape in the published 4.0.5)
- the read skips an unregistered type: lines 860-864 (
MutableHashSet.add(resetAddresses, address)); - with no client message and no full batch, only the poll fiber opens the latch: lines 1071-1076;
registerEntitysets the manager and opens only the per-type latch: lines 1928-1937.
Reproduction
- A
SqlMessageStorage-backedSingleRunnerwith a persisted entity message whose handler has not run (for example, the process was killed mid-handler). - Restart. Build the runner, then register the entity in a later layer.
- Send no new message. The handler runs about
entityMessagePollIntervalafter boot, not at registration.
In our app (gent), a resumed turn took 10.26 s with the default interval and 0.24 s after we call sharding.pollStorage once after registerEntity. With the interval set to one hour, the message did not run within a 10 s test window.
Suggested fix
Open storageReadLatch after entityManagers.set(...) in registerEntity (when the shard set is already acquired), so messages reset during the registration window are read again at once.
Workaround
Call Sharding.pollStorage after each registerEntity at the composition root.
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 10 h 7 min
- PR fusionados (30 d)
- 808
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
Support {self: this} for fnUntracedPosiblemente ocupada @ArjunCodess la tomó hace 32 días. Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Effect-TS/effect#8101 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
v4 Cache.get: a caller that joins an abandoned lookup fails with an interruption it did not ask forAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
Typed unix socket and TLS options for `BunHttpClient` and `DenoHttpClient`Posiblemente ocupada @effect-bot la tomó hoy. Abiertodocker-made-me-do-it enhancement platform
Effect-TS/effect#9687 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
RFC 9457 Problem Details for HttpApi errorsPosiblemente ocupada @effect-bot la tomó hoy. Abiertodocker-made-me-do-it enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
Los mantenedores suelen responder en 1 día
-
Typed parsers and formatters for common HTTP header valuesPosiblemente ocupada @effect-bot la tomó hoy. Abiertodocker-made-me-do-it enhancement
Effect-TS/effect#9685 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
paperclipai/paperclip#17151 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
AgoraIO-Extensions/agent-infra#3159 ·
Los mantenedores suelen responder en 1 día
-
blocklist addition
Dificultad 1/5 Menos de una hora Aptitud para principiantes 66/100
MetaMask/eth-phishing-detect#304596 ·
Los mantenedores suelen responder en 1 día
-
friction
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
kentcdodds/kody#4142 ·
-
[Bug] Statistics | Task statistics are always empty on MikroORM with MySQL or SQLitePosiblemente ocupada @NdekoCode la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ever-co/ever-gauzy#11214 ·
Los mantenedores suelen responder en 1 día