browser-db-sqlite-persistence: closing the leader tab fail-stops follower collections with IndeterminateCommitError
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- playwright, sqlite, typescript
Línea de trabajo
Start by tracing BrowserCollectionCoordinator.assertMutationRouteUnchanged and sendRPC, then follow the persistence runtime paths named in the stack trace: persistAndBroadcastExternalSyncTransactionUnsafe and applyBufferedSyncTransactionUnsafe. Reproduce with two same-origin tabs sharing an OPFS database and close the leader while sync changes arrive. Done means a normal leader close no longer leaves follower collections permanently errored, or the supported reconciliation path is clearly documented.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
With BrowserCollectionCoordinator, closing the leader tab often puts collections in the remaining tab into a permanent error state. The follower's in-flight rpc:applyCommittedTx for a sync-sourced transaction (an Electric change) waits for the closed leader, times out after 10 s, crosses leadership, and rejects with IndeterminateCommitError. The collection fail-stops, and the tab stops getting live rows.
Versions
@tanstack/db0.12.3@tanstack/db-sqlite-persistence-core0.4.7@tanstack/browser-db-sqlite-persistence0.2.32 (OPFS,openBrowserWASQLiteOPFSDatabase)@tanstack/electric-db-collection0.5.8- Chromium (Playwright headless shell), two tabs in one browser context, same origin
Setup
- One OPFS database, shared by the tabs through
BrowserCollectionCoordinator({ dbName })andcreateBrowserWASQLitePersistence({ database, coordinator }). - Seven persisted Electric collections (eager and on-demand), created with
persistedCollectionOptions({ ...electricCollectionOptions(...), persistence, schemaVersion: 1 }).
Steps
- Open tab A. It becomes the leader for every collection.
- Open tab B. Wait until both tabs show live rows.
- Close tab A (
page.close(), a normal close, not a crash). - Keep inserting rows on the server, so that tab B's Electric streams deliver changes.
Observed
3 of 6 runs. About 10 s after tab A closes, tab B logs this (ids shortened):
IndeterminateCommitError: Commit outcome is indeterminate for collection "messages":
rpc:applyCommittedTx:req crossed leadership from 65c2… (term 1) to 2f07… (term 2)
<- Error: RPC rpc:applyCommittedTx:req timed out after 10000ms
at BrowserCollectionCoordinator.assertMutationRouteUnchanged
at BrowserCollectionCoordinator.sendRPC
at async PersistedCollectionRuntime.persistAndBroadcastExternalSyncTransactionUnsafe
at async PersistedCollectionRuntime.applyBufferedSyncTransactionUnsafe
The same error occurred for other collections in other runs, sometimes through flushQueuedHydrationTransactionsUnsafe. The collection stays in error, and every later update() on it throws. While tab A closes, it logs PersistedCollectionDurabilityError ... The page is closing its SQLite connection. In the other 3 runs, tab B took over every leader lock, and sending and receiving continued.
Expected
A normal leader-tab close should not fail-stop the other tab's collections. #1845 makes a leader change during a mutating RPC indeterminate and leaves reconciliation to the application. For a transaction that comes from the sync source, the source can deliver the same changes again from the durable resume offset. So one of these seems possible:
- The closing leader rejects or drains pending RPCs (for example on
pagehide), so the follower does not wait 10 s for a leader that has gone. - For sync-sourced transactions, the runtime reconciles by itself: it re-hydrates and resumes from the persisted offset instead of fail-stopping.
- If the application must reconcile, document how to do it for a sync-sourced collection. Is
collection.cleanup()followed by a new collection the intended path?
Not done
- No standalone reproduction yet. We saw this in an app, driven by Playwright. We can try to reduce it if that helps.
- Lenguaje dominante
- TypeScript
- Estrellas
- 3.9k
- Forks
- 272
- Merge medio
- 1 d 45 min
- PR fusionados (30 d)
- 208
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
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 TanStack/db
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 5/100
Los mantenedores suelen responder en 1 día
-
browser-db-sqlite-persistence: option to load the wa-sqlite WASM by URL instead of inlined base64Posiblemente ocupada @KyleAMathews la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
TanStack/db#2101 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
TanStack/db#1972 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/db
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
[Bug]: [A11y] Missing accessible name on icon-only standalone links (WCAG 2.1 SC 2.4.4, 4.1.2)Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
jaegertracing/jaeger-ui#4596 ·
Los mantenedores suelen responder en 1 día
-
area:tui enhancement platform:macos
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
anthropics/claude-code#101490 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
netlify/netlify-mcp#75 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día