[medium] fix(ci): poll the healthcheck instead of sleeping a fixed 10 seconds - #897
Open
elhoim wants to merge 1 commit into
Open
[medium] fix(ci): poll the healthcheck instead of sleeping a fixed 10 seconds#897elhoim wants to merge 1 commit into
elhoim wants to merge 1 commit into
Conversation
The test job starts misp-modules in the background, sleeps exactly 10 seconds, then runs a single "curl -sS localhost:6666/healthcheck". When the server has not finished importing every module within those 10 seconds, curl exits 7 (failed to connect) and the whole matrix leg fails. The job log shows modules still being imported at the moment the check runs, so this is a startup race and not a defect in the change under test. Because start-up time varies with the runner and the Python version, this fires intermittently and on unrelated pull requests. Replace the fixed sleep and one-shot curl with a bounded poll: retry once a second for up to 60 seconds, succeed as soon as the healthcheck answers, and on timeout print error.log before failing so the real start-up error is visible in the job output. The fast path is now faster than the old unconditional 10-second sleep. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VpjGT8zb2wRNqCjQwFugLC
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.
BLUF — A fixed 10-second sleep before the CI healthcheck races module imports; a bounded poll replaces it.
testjob in.github/workflows/test-package.ymlstarts misp-modules in the background, sleeps exactly 10 seconds, then runs a singlecurlagainst/healthcheck; when module imports have not finished in time the curl exits 7 and the matrix leg fails, so unrelated pull requests go red intermittently.error.logif it never does.The failure
Affected pull requests fail with:
Exit code 7 is curl's "failed to connect to host". Reading up the job log, misp-modules is still importing when the check fires:
Why it is a race
Ten seconds is a guess. Start-up time depends on the runner and on the Python version in the matrix, and misp-modules imports a large number of expansion modules before it listens. When the guess is wrong there is no retry, and the single failure takes the leg down. This shows up on pull requests that do not touch anything related — it has been observed on two changes whose diffs are a SPARQL escaping fix and an exception guard.
A second, smaller problem: the old step used
curl -sSwithout-f, so an HTTP error status would have been reported as success.The change
-fmakes an HTTP error status a failure rather than a pass.error.log, so the cause is visible instead of a bare exit code.CI-configuration change only; no module or test code is touched. Validated with a YAML parse of the workflow (12 steps, correctly ordered) and
bash -non the script body.🤖 Generated with Claude Code