🤖 Concurrency primitive and fileLock hazards found by the formal models (#5309, #5319 follow-ups)

Chiusa
#5,332 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ThomasK33 ci sta già lavorando.

Dal 30/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Tracking issue for concurrency-primitive hazards found while modeling them (formal/primitives/, formal/filelock/). None of these was fixed in #5309 or #5319.

  1. AsyncSemaphore.releaseSlot() is still public (from #5309). src/node/utils/concurrency/asyncSemaphore.ts exposes it, so a caller can release a slot it never acquired and break the FIFO hand-off. Make it private, or route all releases through the returned lock handle.
  2. MutexMap is not reentrant (src/node/utils/concurrency/mutexMap.ts). A nested withLock on the same key deadlocks. At minimum, say this in the doc comment. Optionally, assert on nested use in tests.
  3. KeyedFifoLock.acquire with a far deadline times out at once (src/node/services/workflows/keyedFifoLock.ts). The timer delay is deadline - Date.now(). Node clamps delays above 2^31-1 ms (about 24.8 days) to 1 ms, so such a waiter resolves null almost immediately. Clamp the delay, or re-arm the timer in chunks.
  4. fileLock swallows unlink failures for .stale-* graveyard files (from #5319). Failed cleanups are silent, so graveyard files can pile up unnoticed. Log them at debug level.
  5. fileLock reclamation fails closed at MAX_RECLAIM_DEPTH = 8 (src/node/utils/concurrency/fileLock.ts). This is intended, but the user-facing fix is "remove it manually". Check whether this depth is reachable in practice, and give the manual-recovery step a documented home.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $37.39

Lingua principale
TypeScript
Stelle
2.1k
Fork
139
Merge medio
3h 35m
PR unite (30g)
950

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

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 coder/xum

Tutte le issue di coder/xum

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.