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

Cerrado
#5,332 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@ThomasK33 ya está trabajando en esto.

Desde el 30/9/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
2.1k
Forks
139
Merge medio
3 h 35 min
PR fusionados (30 d)
950

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de coder/xum

Todos los issues de coder/xum

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.