Stop the proxy test hanging Windows CI for six hours - #13
Merged
Merged
Conversation
`build (windows-2022)` has been failing on a six-hour job timeout since #5, and the last thing its log says is mine: test an_https_proxy_in_the_environment_is_used has been running for over 60 seconds … 5.95 hours … ##[error]The operation was canceled. It went unnoticed because every run on `main` during the 0.2.0 merges was cancelled by the next push long before six hours elapsed. #12 — a one-line CODEOWNERS file from a bot — is simply the first run left alone long enough to time out. **Two faults, and the second is the one that turned a failure into a wedge.** The test cleared the child's environment and set `PATH` back. On Windows that takes `SystemRoot` with it, and without `SystemRoot` the socket and TLS stacks cannot initialise — so the CLI failed before it could reach any proxy. `tests/update_check.rs` spawns the binary too and uses `env_remove` for the handful of variables that would interfere; this now does the same, and also clears the proxy variables themselves so a developer's own `HTTPS_PROXY` cannot change the result. And it blocked on `accept()` with no deadline, on a thread it then joined. So "the CLI never connected" was indistinguishable from "the CLI has not connected yet", and the job sat there until GitHub killed it. `accept_within` gives it a 30-second bound: nothing arriving is now a *result*, reported as a failure that names the variable and quotes what the CLI said. Verified the bound does what it claims rather than assuming: with the CLI made to bypass the proxy, the test fails in **3.01 seconds** with nothing reached the fake proxy within 3s, so HTTPS_PROXY was not used. The CLI said: … The environment fix is the diagnosis; the deadline is the guarantee. I cannot run Windows here, so if `SystemRoot` was not the whole story the test will now say so in half a minute instead of burning a runner for six hours. Also spawns the child rather than running it to completion, since the connection only arrives while it is running — which removes the thread entirely. 588 tests, fmt and clippy clean.
zmofei
approved these changes
Sep 15, 2026
This was referenced Sep 15, 2026
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.
Fixes the
build (windows-2022)failure on #12 — which isn't #12's fault. That PR is a one-line CODEOWNERS file from a bot; it's just the first run left undisturbed long enough to hit the six-hour job timeout.What's happening
The last thing the Windows log says before the gap is my test, from #5:
It's been broken on
mainsince #5 merged. Nobody saw it because everymainrun during the 0.2.0 merges was cancelled by the next push well inside six hours.Two faults; the second is what turned a failure into a wedge
The environment. The test used
env_clear()and putPATHback. On Windows that takesSystemRootwith it, and withoutSystemRootthe socket and TLS stacks can't initialise — so the CLI failed before it could reach any proxy.tests/update_check.rsspawns the binary too and uses targetedenv_remove; this now matches it, and additionally clears the proxy variables so a developer's ownHTTPS_PROXYcan't change the result.The unbounded wait. It blocked on
accept()with no deadline, on a thread it then joined. So "the CLI never connected" was indistinguishable from "the CLI hasn't connected yet", and the job sat there until GitHub killed it.accept_withinnow bounds it at 30 seconds. Nothing arriving is a result, reported as a failure that names the variable and quotes what the CLI said.Verified, not assumed
With the CLI made to bypass the proxy so nothing connects:
3.01 seconds, with a diagnosable message, instead of six hours.
Being straight about the split: the environment change is the diagnosis and the deadline is the guarantee. I can't run Windows here, so if
SystemRootwasn't the whole story, the test will now say so in half a minute rather than burning a runner — and the message will carry the CLI's own stderr to say why.Also spawns the child instead of running it to completion, since the connection only arrives while it's running. That removes the thread entirely.
588 tests, fmt and clippy clean.
Worth a follow-up, separately
build (windows-2022)evidently isn't a required check — #5 merged with it unfinished, and so did several others during the 0.2.0 run. A six-hour timeout also means a genuine Windows break costs a runner for six hours before anyone hears about it. Both are worth revisiting: atimeout-minuteson that job would turn the next one into a fast, loud failure.