chore(test-runner): hard-kill wedged jperl with timeout -k#567
Merged
Conversation
…ard-killed GNU `timeout` only sends SIGTERM by default. If jperl/JVM ignores or hangs in response to SIGTERM (e.g. blocked in a JNI call or a stuck shutdown hook), the wrapped process can outlive the configured timeout indefinitely -- we observed an `op/gv.t` worker still running ~10 hours after a 300s timeout. - Pass `-k 10s` to both `timeout` and `gtimeout` so SIGKILL follows SIGTERM after a short grace period. - Skip detection on Windows ($^O = MSWin32/cygwin/msys); Windows' built-in `timeout.exe` is a sleep-with-countdown, not GNU timeout, so calling it as `timeout 300s ...` would be wrong. Windows keeps using the alarm-based fallback. - Treat exit codes 137 (128+SIGKILL) and 143 (128+SIGTERM) as 'timeout' status alongside 124, so `-k`-killed processes are still classified as timeouts rather than generic errors. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
Summary
GNU
timeoutonly sendsSIGTERMby default. If jperl/JVM ignores or hangs in response to SIGTERM (e.g. blocked in a JNI call or a stuck shutdown hook), the wrapped process can outlive the configured timeout indefinitely. We observed anop/gv.tworker still running ~10 hours after a 300s timeout.This patches
dev/tools/perl_test_runner.plso wedged jperl processes are actually killed:-k 10sto bothtimeoutandgtimeout, soSIGKILLfollowsSIGTERMafter a short grace period.timeoutdetection on Windows ($^OofMSWin32/cygwin/msys). Windows' built-intimeout.exeis a sleep-with-countdown utility, not GNU timeout, so calling it astimeout 300s ...would corrupt the command. Windows continues to use the existingalarm()-based fallback.SIGKILL) and 143 (128+SIGTERM) as thetimeoutstatus alongside 124, so-k-killed processes are still classified as timeouts rather than generic errors.Test plan
perl -c dev/tools/perl_test_runner.pl— syntax OKmake— full unit test suite passestimeout -k 10s 300s ...timeout -k; macOS usestimeout -kif homebrew coreutils is present, else falls through togtimeout -k; Windows falls through to the alarm fallback (unchanged behavior)Generated with Devin