pglite-socket: keep an extended-query batch on one connection until Sync

Aperta
#1,192 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
node.js, postgresql, typescript
Ambito
backend, databases

Direzione di ricerca

Start by reading the @electric-sql/pglite-socket 0.2.17 source for QueryQueueManager and processQueue, then inspect the related work in issues #1046 and #977. Reproduce the interleaving and queue-stall cases with concurrent pg pools, and check how the proposed batch handling affects disconnect cleanup and transaction ownership. Done means a regression test covers the reported failures and the maintainers have chosen an approach.

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

Descrizione

This is a fix proposal for #1046. The problem is still present in @electric-sql/pglite-socket 0.2.17.

  1. QueryQueueManager gives the backend to another handler after each message. Two clients that send Parse/Bind/Execute batches can interleave, which gives 08P01 (protocol violation) and 34000 (invalid cursor).
  2. When processQueue throws, it returns without clearing processing, so the queue stops for good.

Change we run locally (patched 0.1.5 since 2026-10-26):

  • A handler keeps the backend until its batch reaches Sync. Transaction ownership stays as it is.
  • On disconnect, the cleanup syncs an unfinished batch, rolls back its transaction, and releases queued connections.
  • processing is cleared in finally.

This fixed concurrent HTTP 500s with 08P01 and 34000 from pg pools in our test suite. The simple-query COPY limitation is unchanged. #977 covers part of this. Which approach do you want? We can port the change to the 0.2.17 source and add a regression test with two concurrent pg pools.

Lingua principale
TypeScript
Stelle
16.3k
Fork
474
Merge medio
23h 53m
PR unite (30g)
53

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 electric-sql/pglite

Tutte le issue di electric-sql/pglite

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.