You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(telemetry): Stop the SIGTERM export test from hanging to 600 s - #6073
The child of the SIGTERM export test waited for SIGTERM in signal.pause(). A SIGTERM that came after the last check for signals and before the pause system call set only the flag of the C handler, and the pause then waited for a second signal. The test hung to the 600 s bound of pytest-timeout in Service Image Tests and held the certifi security update of pull request #6028. The child now waits on the read end of its signal.set_wakeup_fd pipe, which the C handler writes, so a signal that comes before the read ends the wait too. The test waits for the line of the child with wait_while_running, sends SIGTERM after any line, and kills and reaps the child on each path. The product handler does not change.
The hang in CI. In the last 50 runs of Service Image Tests (all attempts), the test ran past the 600 s bound in 4 shard jobs: 133095388623 (schedule on main, 2026-11-16 04:39Z), 133581940030 (#6028), 133637219622 and 133648554544 (#6047). The test came in with #5926 on 2026-11-16 03:01Z, so it hung in 4 of the 8 completed run attempts since then. Each stack shows the test in child.wait() after it sent SIGTERM.
Reproduction (devcontainer, 16 CPUs, 24 children at a time). A script ran the child of the test, read ready, sent SIGTERM and waited 20 s:
Child
Runs
Hung
Old child, signal.pause()
600
41
Old child, a loop of time.sleep(0.05) in place of the pause (control)
800
0
New child, os.read on the signal.set_wakeup_fd pipe
1,200
0
Each hung child was in the kernel function __do_sys_pause, with SigCgt holding SIGTERM (bit 0x4000) and SigPnd, ShdPnd, SigBlk and SigIgn without it. So the kernel had delivered SIGTERM and the C handler had run, but the Python handler had not: no hung child had recorded an export. The pause had started after the signal.
The fixed test in the image. A manual run of Service Image Tests on this branch passed all 6 shards: run 43981764792. (The workflow does not run on a pull request that changes only tests.)
Locally.uv run devops ci test tests/telemetry/test_sigterm_export.py: 4 passed in 0.92 s.
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
scope/telemetryOpenTelemetry tracing spans, Prometheus metrics, and Jaegertype/testType test: a new or changed test
1 participant
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.
The child of the SIGTERM export test waited for SIGTERM in signal.pause(). A SIGTERM that came after the last check for signals and before the pause system call set only the flag of the C handler, and the pause then waited for a second signal. The test hung to the 600 s bound of pytest-timeout in Service Image Tests and held the certifi security update of pull request #6028. The child now waits on the read end of its signal.set_wakeup_fd pipe, which the C handler writes, so a signal that comes before the read ends the wait too. The test waits for the line of the child with wait_while_running, sends SIGTERM after any line, and kills and reaps the child on each path. The product handler does not change.
Closes #6048
Change:
openspec/changes/archive/2026-11-16-6048-sigterm-export-test-race/Co-Authored-By: Claude [email protected]