Skip to content

Stop the proxy test hanging Windows CI for six hours - #13

Merged
zmofei merged 1 commit into
mainfrom
proxy-test-windows
Sep 15, 2026
Merged

zmofei merged 1 commit into
mainfrom
proxy-test-windows

Conversation

@mattpodwysocki

Copy link
Copy Markdown
Contributor

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:

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's been broken on main since #5 merged. Nobody saw it because every main run 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 put PATH back. On Windows that takes SystemRoot with it, and without SystemRoot the socket and TLS stacks can't initialise — so the CLI failed before it could reach any proxy. tests/update_check.rs spawns the binary too and uses targeted env_remove; this now matches it, and additionally clears the proxy variables so a developer's own HTTPS_PROXY can'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_within now 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:

test an_https_proxy_in_the_environment_is_used ... FAILED
panicked at tests/proxy.rs:79:9:
nothing reached the fake proxy within 3s, so HTTPS_PROXY was not used. The CLI said: …
test result: FAILED. … finished in 3.01s

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 SystemRoot wasn'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: a timeout-minutes on that job would turn the next one into a fast, loud failure.

`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
zmofei merged commit b11dc95 into main Sep 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants