Skip to content

tests: two CI flakes: the security check's over-cap close race, and check-release-paths run before its install finishes - #3349

Merged
ashhart merged 3 commits into
mainfrom
lead/ci-flakes-2
Nov 14, 2026
Merged

ashhart merged 3 commits into
mainfrom
lead/ci-flakes-2

Conversation

@ashhart

@ashhart ashhart commented Nov 14, 2026

Copy link
Copy Markdown
Owner

tests and build: two CI flakes, an over-cap body racing the server's close and a checker run racing its install

Two failures on hosted runners today. Neither was a product bug. Each commit fixes one.

1. The server security check: "Transport endpoint is not connected"

"GET body of 65537 bytes against the unread cap" failed with [Errno 107] Transport endpoint is not connected.

Why:

  • The server refuses that request on its declared Content-Length (zig/src/server/http_body.zig:79) and closes without
    reading the body.
  • The unread bytes then reset the connection.
  • On a busy runner, the reset can reach the client while it's still sending or half-closing, before it reads the 400.

What changes (zig/tests/server/security_check.py):

  • exchange() can treat a reset, a closed pipe or a no-longer-connected socket as the server closing first. Only the
    over-cap case asks for that; every other case still fails on such an error, as before.

  • When the server closed first, nothing that arrived may be a 2xx reply, and a complete reply must be the expected 400.

  • A new case proves the cap with no race. It sends only the head declaring 65,537 bytes. Nothing is left unread, so
    the server closes cleanly and its 400 always arrives.

    This case matters because after a reset the kernel drops any reply not yet read. A reset alone can't show that the
    request wasn't served; this case can.

Checks:

  • zig build -Dfixed-cpu test-server-security: 28 passed, 0 failed (27 before, plus the new case).
  • I also drove exchange against a local server that resets after the head: the close-first path accepts it, and the
    strict path still raises.

2. check-release-paths: FileBusy

"failed to spawn and capture stdio from ./zig-out/bin/check-release-paths: FileBusy" (ETXTBSY).

Why:

  • Zig 0.17's run step executes an artifact's installed copy whenever the same build installs it
    (lib/compiler/Maker/Step/Run.zig:388: installed_path orelse the cache path). It doesn't wait for the install.
  • compile-release-paths-host installed the same checker that the release directory and command tests run.
  • So a build doing both, such as test-host, could start a run while the install was still writing the file.

What changes (zig/build/cuda_release_paths.zig): compile-release-paths-host installs a compile of its own. The
tests' checker is never installed, so every run starts the finished file in the cache. Both compiles share one cache
entry, so nothing builds twice, and zig-out/bin/check-release-paths is still installed as before.

Traced with strace in one build of compile-release-paths-host, test-release-directory-host and
test-release-paths-command-host:

Runs of ./zig-out/bin/check-release-paths Runs from the cache
main 17 1
this branch 0 18

Checks: test-check-release-paths, test-release-paths-host, test-release-directory-host,
test-release-paths-command-host and compile-release-paths-host pass with -Dfixed-cpu.

Both

No change to the server or the checker itself. zig fmt --check is clean, and lean is 341, the same as main.

🤖 Generated with Claude Code

…ap body, and proves the cap without a race

"GET body of 65537 bytes against the unread cap" failed on a hosted runner with "[Errno 107]
Transport endpoint is not connected". The server refuses that request on its declared length
(http_body.zig:79) and closes without reading the body, so the unread bytes reset the
connection; on a busy runner the reset can reach the client while it is still sending or
shutting down its side, before it reads the 400.

- exchange() can treat a reset, a closed pipe or a no-longer-connected socket as the server
  closing first. Only the over-cap case asks for that; every other case still fails on it.
- When the server closed first, whatever arrived must not be a 2xx reply, and a complete reply
  must be the expected 400.
- A new case sends only the head declaring 65,537 bytes. Nothing is left unread, so the server
  closes cleanly and its 400 always arrives: the cap is proved on every run, with no race.
…o a run never executes a file mid-write

A hosted runner failed with "failed to spawn and capture stdio from
./zig-out/bin/check-release-paths: FileBusy" (ETXTBSY). Zig 0.17's run step executes an
artifact's installed copy whenever the same build installs it
(lib/compiler/Maker/Step/Run.zig:388, `installed_path orelse` the cache path), without waiting
for the install. compile-release-paths-host installed the same checker that the release
directory and command tests run, so a build doing both, such as test-host, could start a run
while the install was still writing zig-out/bin/check-release-paths.

compile-release-paths-host now installs a compile of its own; the tests' checker is never
installed, so every run starts the finished file in the cache. Both compiles share one cache
entry, so nothing builds twice. Traced with strace in one build of compile-release-paths-host,
test-release-directory-host and test-release-paths-command-host: on main 17 of 18 runs
executed ./zig-out/bin/check-release-paths; now all 18 run from the cache.
@ashhart
ashhart merged commit 2ce56fb into main Nov 14, 2026
2 of 10 checks passed
@ashhart
ashhart deleted the lead/ci-flakes-2 branch November 14, 2026 17:03
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.

1 participant