Repository navigation
Install the default SIGINT handler in the self-SIGINT interrupt test - #93
Merged
Merged
Conversation
test_sigint_during_a_query_that_calls_python_is_a_keyboard_interrupt sends SIGINT to its own process and needs Python's default_int_handler. Python installs that handler at startup only when SIGINT is not ignored, and a pytest started as a background job (a shell `cmd &` without job control, many launchers and agent shells) inherits SIGINT as ignored, so the signal was dropped, no query was interrupted and the test failed every time (20 of 20 on the laptop, on both the 26.10.2 and the 26.11.1-SNAPSHOT engine) while it passed in CI. The test now installs signal.default_int_handler for its duration and restores the old handler. tests/README.md says how to check a runner. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
tests/test_python_function_interrupt.py::test_sigint_during_a_query_that_calls_python_is_a_keyboard_interruptfailed every time (assert 0 >= 1, 20 of 20) on a runner that starts pytest as a background job, on both the 26.10.2 and the 26.11.1-SNAPSHOT native engine, and passed in CI. The binding is fine; the test relied on a handler Python does not always install.Cause: Python installs
signal.default_int_handlerat startup only when SIGINT is not ignored. A shell runs an asynchronous command (cmd &, no job control) with SIGINT set toSIG_IGN, and the setting survivesexec, so the pytest process starts withgetsignal(SIGINT) == SIG_IGN.os.kill(os.getpid(), SIGINT)is then dropped, no query is interrupted, and the test runs the full 22 to 25 s of eight uninterrupted queries before it fails.Evidence, same wheel and test, one launch path changed at a time:
getsignal(SIGINT)in the testquiet_build.sh(systemd scope, taskset, nice)default_int_handlerbash -c "... & wait"SIG_IGN(SigIgnbit0x2set in/proc/self/status)&launch,default_int_handlerinstalled firstdefault_int_handlerSo the scope, nice and taskset layers do not matter, and the native default-handler path (
_dispatchentry, interrupt note, error reply,KeyboardInterrupt) works: the test passes there with the handler in place.test_sigint_loop_in_a_fresh_process_ends_cleanlyandtest_sigint.pyalready install the handler for their child processes for the same reason.Fix: a
default_sigint_handlerfixture installssignal.default_int_handlerfor the test and restores the old handler.tests/README.mdgets a short section on how to check a runner (grep SigIgn /proc/self/status, bit0x2).Checked on the laptop with the final file, pytest started as an
&job (SIGINT ignored),tests/test_python_function_interrupt.pywhole:scripts/check_no_embedded_name.py --root .is clean and black reports nothing on the changed lines.🤖 Generated with Claude Code