Task identifier cache keeps a rejected lookup forever, wedging the runner after a connection drop
@agustin18 ci sta già lavorando.
Dal 23/11/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, postgresql, typescript
- Ambito
- backend
Direzione di ricerca
Inizia in src/taskIdentifiers.ts: cache.lastStr e cache.lastDigest vengono impostati prima del lookup asincrono e non vengono mai cancellati quando quest'ultimo viene rifiutato, quindi getJobs attende lo stesso rifiuto a ogni poll. Leggi quella logica di cache insieme alla chiamata withPgClient.withRetries (che ritenta solo 40001/40P01/57P03/EHOSTUNREACH/ETIMEDOUT) e al logging di getJob a livello debug in worker.js. Riproduci terminando il backend del lookup con pg_terminate_backend e aggiungendo un job; done significa che il runner si riprende al poll successivo, idealmente con errori ripetuti registrati sopra debug.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: graphile-worker 0.18.0 (the same code is on main)
What happens
If the task-identifier lookup fails once (for example the Postgres backend is terminated with pg_terminate_backend, a failover, "Connection terminated unexpectedly", or a pool checkout timeout during the first poll after start), the runner never recovers. It keeps polling every pollInterval, each poll fails with the same error logged only at debug level, and jobs added afterwards never run. The runner promise never settles, so a supervisor has nothing to restart.
Cause
src/taskIdentifiers.ts sets cache.lastStr before the async lookup and stores the lookup's promise in cache.lastDigest. Nothing clears them when that promise rejects, so every later call returns the same rejected promise. The lookup runs through withPgClient.withRetries, which retries only 40001, 40P01, 57P03, EHOSTUNREACH and ETIMEDOUT; a 57P01 (admin shutdown) or a dropped connection fails once and is then cached. getJobs awaits that cached rejection on every poll, and worker.js logs it at debug.
Reproduce
- Start a worker pool with a few task identifiers.
- Terminate the backend running the lookup's
insert into graphile_worker._private_tasks(select pg_terminate_backend(pid) ...) while it runs. - Add a job. It stays
locked_by = null, attempts = 0and due; the log shows only debug-level getJob errors (about 170 in 10 s).
Adding 0–40 ms of random delay to pool checkout makes this happen in roughly 1 in 4 starts under a terminated connection.
Suggested fix
Clear the cache when the lookup rejects, so the next poll retries it:
cache.lastDigest.catch(() => {
if (cache.lastStr === str) cache.lastStr = '';
});
We run this as a local patch and the runner recovers on the next poll. It may also be worth logging repeated getJob failures above debug level.
- Lingua principale
- TypeScript
- Stelle
- 2.5k
- Fork
- 134
- Merge medio
- 16h 24m
- PR unite (30g)
- 3
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna 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 graphile/worker
-
Memory leak: `taskIdentifiers` cache keeps every `run()`'s options for the life of the processAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Batched `completeJobs`/`failJobs` are never retried: the retry loop in `batch()` exits after the first failureForse già presa @ujjawal-yadav l’ha presa 42 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
`runner.promise` resolves when the worker pool exits with an errorForse già presa @Krrishkumar125 l’ha presa 35 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Write docs for local queue!Forse già presa @Krrishkumar125 l’ha presa 34 giorni fa. Apertadocs
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Unhandled rejection when recording a job's outcome fails with unbatched completeJob/failJobForse già presa @cpruijsen l’ha presa 44 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
Tutte le issue di graphile/worker
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
abhigyanpatwari/GitNexus#4124 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
laaielichter/Godotwright#250 ·
I maintainer di solito rispondono entro 1 giorno
-
An Antigravity tab can quote an old Assist message as the owner's words in a resumed conversationAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Retry an empty final answer when Gemini reports MALFORMED_RESPONSE (gemini-4-hydrogen)Forse già presa @waleedkadous l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
iaser-ai/ansari#444 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Manager UI logo fails to load — broken external URLForse già presa @kavindu-udara l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100