Repository navigation
Drain msgd work before shutdown and stop new effect claims - #209
LIghtJUNction wants to merge 2 commits into
Conversation
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Update: fixed in Original finding at P2: the shutdown guard still allows a new tool claim if SIGTERM arrives during the concurrency lookup (head In I reproduced this with the exact fetched Please recheck the stop flag immediately before the pending-to-running transition and add a regression that signals during the concurrency content read. That should prevent a new claim while preserving the existing drain/lease handling for effects already in flight. |
|
Both graceful-shutdown commits were integrated directly into main at 97876ec, without a second merge. Released as msgctl 0.2.1 and deployed as msgd 0.2.1-20261001.2. Both production services are active, with KillMode=mixed and a 90-second systemd stop timeout. Closing this superseded PR; no additional code changes. |
SIGTERM during worker maintenance could still claim another effect, and systemd signalled sandbox children before their parent could drain. Stop new work when shutdown begins, allow the current stage 60 seconds, and preserve cancelled jobs' durable leases rather than acknowledging them. HTTP drain is bounded to 60 seconds and all three service units allow 90 seconds including cleanup with parent-first signals.
Storage cleanup now runs even when lifespan/load fails and closes Valkey connections.
Validation: all 7 shutdown tests passed, including real OS SIGTERM during load/maintenance/job, bounded cancellation, a real HTTP socket response draining before storage close while new connections are refused, and PostgreSQL effect leases remaining running on cancellation before expiring to uncertain. Valkey integration regressions passed (10 tests including the initial shutdown cases). Ruff and diff checks passed. Broader shutdown/lease/fencing/retry/PostgreSQL regressions passed: 64 tests.
Based on the deployed money branch to keep the graceful-shutdown diff independent.