Shutdown: an open browser tab holds the HTTP drain for 15 s, so under Docker's 10 s stop the audit seal, batched saves and s3 lock release are lost #1010

Closed
opened 2026-10-26 10:56:12 +00:00 by Cordy · 0 comments
Owner

Found in the batch 8 review (.superpowers/sdd/2026-10-26-batch8/review-a.md F1, final-review.md R1). This predates v0.6.356.

What happens:

  • Every open tab keeps the /api/events live-update stream open, so srv.Shutdown waits its full 15 s.
  • releaseStateLock() runs only after the drain. It seals the audit tail, flushes batched saves and releases the s3 boot lock.
  • Docker's default stop timeout is 10 s, so the process is killed first. Kubernetes' default of 30 s survives.

v0.6.356 mitigation:

  • The CHANGELOG and the Compose example set stop_grace_period: 30s.
  • The #1009 removal now runs during the drain.

Fix:

  • Close the event streams as soon as shutdown starts (cancel their contexts via RegisterOnShutdown), so the drain ends in about 1 s.
  • Test: with an open stream, shutdown completes within 2 s and the state lock is released.
Found in the batch 8 review (`.superpowers/sdd/2026-10-26-batch8/review-a.md` F1, final-review.md R1). This predates v0.6.356. **What happens:** - Every open tab keeps the `/api/events` live-update stream open, so `srv.Shutdown` waits its full 15 s. - `releaseStateLock()` runs only after the drain. It seals the audit tail, flushes batched saves and releases the s3 boot lock. - Docker's default stop timeout is 10 s, so the process is killed first. Kubernetes' default of 30 s survives. **v0.6.356 mitigation:** - The CHANGELOG and the Compose example set `stop_grace_period: 30s`. - The #1009 removal now runs during the drain. **Fix:** - Close the event streams as soon as shutdown starts (cancel their contexts via `RegisterOnShutdown`), so the drain ends in about 1 s. - Test: with an open stream, shutdown completes within 2 s and the state lock is released.
Cordy closed this issue 2026-10-27 01:28:43 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#1010
No description provided.