Repository navigation
Stop a build's run on SIGTERM and queue the build again at once - #209
Merged
Merged
Conversation
VisualCIdocspring/visualci · build #771 · 521 unchanged · no changes This PR vs base: 9 changed since #729, across 2 builds docspring/visualci · journeys · build #769 · 50 unchanged · no changes This PR vs base: 1 changed since #738, across 2 builds Updated as builds change. Agents can review with VisualCI's MCP tools. |
ndbroadbent
force-pushed
the
processing-sigterm
branch
from
December 4, 2026 16:01
c55cbd1 to
3b0976e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a rollout or a scale-down replaces a worker pod, Kubernetes sends
SIGTERM.queue:work(laravel-rust 0.1.4) then stops taking jobs and waits for the running ones to finish. A large build's run outlasts the pod's grace period and gets killed part-way. Its build then sits until the processing lock's hold lapses and the sweep runs it again.Now a
ProcessBuildrun starts a SIGTERM listener, once per process (domain::shutdown). The comparison loop checks the flag between snapshots. On SIGTERM the run stops and returnsshutdown::Stopped. That releases the lock (exclusivereturns), andrundispatchesProcessBuildagain at once. The build staysprocessingand isn't failed. Another worker takes it straight away and processes it from the start. Comparing a snapshot again replaces its pages, so repeating comparisons is safe.Test:
tests/shutdown.rsis its own binary, because it sets process-wide state. It sends a real SIGTERM to the test process, then runs the build. The run stops before comparing anything, the build staysprocessing,ProcessBuildis queued again (fake queue), and the lock is free straight away. A second run then finishes the build. With the check taken out of the loop, the test fails: the build completes in the stopped run.Not covered here: the two-worker end-to-end test the plan mentioned (kill one of two real workers mid-build). This test checks the same behaviour inside one process.
docs/design-storage.md describes the behaviour, next to the processing lock.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.