Repository navigation
fix: stop on SIGTERM when started with SIGINT ignored, and event-driven interrupt tests - #1531
Merged
Merged
Conversation
… time The busy-split-hosts interrupt tests and four Recall SIGTERM and Ctrl-C tests sent their signal on a timer and asserted elapsed time, so they failed in runners that start commands with SIGINT ignored or under load. They now send the signal once the blocking step has started (rule invocations started, the task printed, the store shows the step running) and assert outcomes and counts: the interrupt was raised, hosts launched, fewer invocations than models, no child processes or host inputs left, the exit code, no statement without an end, and that the step's post-sleep output is absent. A generous bound remains only to fail a hang. Processes the tests interrupt get default SIGINT handling. A new unit test interrupts the single-host fallback and fails if the pending interrupt is ever lost.
After SIGTERM, the command cancels its running statements and interrupts its main thread by sending it SIGINT, but only when Python handles SIGINT. A process started with SIGINT ignored, as background jobs of scripts and many process managers and CI runners are, therefore kept running its blocking step, such as a task or a slow sink import, to the end. Orchestrators then SIGKILL it after their grace period, before it cleans up. When SIGINT is not handled, the command now installs a handler on an otherwise unused signal (SIGRTMIN, or SIGUSR2 where there is none) while that signal is at its default action, and the SIGTERM watcher interrupts the main thread with it. The handler raises the same termination error, so the command exits 143 as before, and is restored when the command ends. SIGINT itself is unchanged: when it was ignored, Ctrl-C stays ignored. Windows is unchanged. An end-to-end test starts the native sqb build with SIGINT ignored and sends SIGTERM once its task is running.
kvlonge
enabled auto-merge
November 17, 2026 02:50
…rrupt-tests # Conflicts: # fensu.toml
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.
Why
Interrupt and SIGTERM tests sent their signal on a timer and asserted elapsed time, so they failed under load and in runners that start commands with SIGINT ignored. That exposed a product gap. When
sqbis started with SIGINT ignored, SIGTERM cancelled statements and exited 143, but the blocking step, such as a task or a slow sink import, ran to its end. Background jobs and CI runners often start processes that way; orchestrators SIGKILL after a 10–30 s grace.Changes
sqlbuild-python-basebeside the Ctrl-C handler.sqlbuild-pythongrows by 8 code lines (wiring into the termination handler). Its cap moves from 66,756 to exactly 66,764.sqb buildwith SIGINT ignored, SIGTERM once its task runs. On main the task still finished its 60 s sleep.No DuckShop case: this is CLI signal handling, not a project shape, value or lifecycle.
Verification
make check-cipasses.make test: 12,310 passed; 4 need Docker, absent here.