Skip to content

docs(testing): D-19 says what the nextest LEAK was, and that it is not the slugify test's defect - #182

Merged
aRustyDev merged 1 commit into
mainfrom
docs/slugify-leak-hunt
Nov 15, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
docs/slugify-leak-hunt

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

Part of #58; this PR does not close it.

#166's commit message reports that thrust-api-v1's parity_slugify_of_drawn_names_is_the_pins was "leaky" once in the full parallel run. This is the result of looking for that, and it changes the question: the slugify test is not what leaks, and nothing in Thrust's code is. There is nothing to fix in a test or in the nextest config, so this adds the record (D-19) and the measurement it rests on.

What a LEAK is

nextest 0.9.140's LEAK is a pass whose stdout or stderr pipe is still open 200 ms after its process exited (the default leak-timeout since 0.9.108; the docs still say 100 ms in places). A leak is a pass unless the profile says leak-timeout = { period = ..., result = "fail" }, which shows as LEAK-FAIL. (Leaky tests, changelog.)

What I found

  • The slugify test cannot leak. It reads an include_str! fixture and parses it per test: no thread, no process, no static, no shared path, no proptest file.
  • A leak does happen, to another test. 50 runs on the Mac that saw it (the ci profile, no retries): 1 of 30 full runs (20 plain, 10 with 18 busy loops on 18 cores) flagged one test, thrust-core::change_password the_old_password_shares_the_sign_in_allowance_and_is_counted_before_any_hashing::sign_ins_first_1_true, at 0.211 s (the 200 ms plus its own 11 ms). No run flagged a slugify test, and 20 runs of -p thrust-api-v1 alone under the same load flagged none. That is 128,560 test runs and one leak.
  • That test has one thread and spawns nothing (argon2 is built without its parallel feature), so another process held its pipe.
  • CI shows none, which tells nothing: the hermetic logs of the 49 runs on main where it ran (178,194 PASS lines) hold no LEAK. At the Mac's rate about 1.4 would be expected, so none has a probability of about 1 in 4.

The mechanism, reproduced without any test of ours

tools/fd-race (std only, its own workspace): 16 threads spawn children with piped stdout, one in eight living 400 ms, the others exiting at once, and it times how long a short child's stdout takes to reach EOF after it exited.

runs short children EOF held 100 ms or more worst
macOS 27.3 3 62,976 5 408 ms
Linux (aarch64, rust:1) 2 41,984 0 0 ms

Each delay is the lifetime of the holder. On macOS std makes a pipe with pipe() and then fcntl(FD_CLOEXEC), two steps; a child another thread spawns between them keeps the write end across exec. Linux has pipe2(O_CLOEXEC).

Not shown: that nextest's own spawn is what does this in a run. Nobody ran lsof while a leak was happening, and the rate of one in about 128,000 makes that a long wait.

What changes

  • docs/src/testing/status.md: D-19, with the numbers above and what each does and does not show.
  • tools/fd-race/: the program, its README and results/2026-11-15.txt (every run, as printed). It builds with --locked.

No test and no .config/nextest.toml change, as you chose for the case where the slugify leak is not found (a leak is a pass; result = "fail" would turn about one test run in 128,000 of an OS race into a red build; a longer leak-timeout is AGENTS.md rule 3's timeout raised to get green). The reading is: a LEAK on a Mac is noise about the run, and one in CI, where the race should not exist, would be a finding.

The two scripts that did the 50 runs and read the 49 CI logs are in my session's scratchpad, not committed (D-19 says so).

🤖 Generated with Claude Code

…t the slugify test's defect

#166's message reports `parity_slugify_of_drawn_names_is_the_pins` as "leaky" once in a full run. The test is pure: an `include_str!` fixture parsed per test, no thread, no process, no static, no shared path, so nothing in it can leak. nextest's `LEAK` (0.9.140, `leak-timeout` 200 ms by default since 0.9.108) is a pass whose stdout or stderr pipe is still open that long after the process exited, and a leak passes unless the profile asks for `result = "fail"`.

Reproduced on 2026-11-15 on the Mac that saw it: 1 of 30 full `--profile ci --workspace` runs (20 plain, 10 with 18 busy loops on 18 cores) flagged one test, and it was `thrust-core::change_password ...::sign_ins_first_1_true` at 0.211 s, not a slugify test; 20 runs of `-p thrust-api-v1` alone under the same load flagged none (128,560 test runs, 1 leak). That test has one thread and spawns nothing, so another process held its pipe. CI's `hermetic` logs (Linux) hold no LEAK in 49 runs, which does not tell the platforms apart (about 1.4 expected at the Mac's rate; none has a probability near 1 in 4).

The mechanism reproduces without any test of ours (`tools/fd-race`, std only): 16 threads spawn children with piped stdout, one in eight living 400 ms; on macOS 5 of 62,976 short children (3 runs) had their stdout held 100 ms or more after exiting, 406 to 408 ms at worst, the holder's lifetime; on Linux 0 of 41,984 (2 runs). On macOS std makes a pipe with `pipe()` then `fcntl(FD_CLOEXEC)`, and a child another thread spawns between the two keeps the write end across `exec`; Linux has `pipe2(O_CLOEXEC)`. What is not shown: that nextest's own spawn is what does it in a run (no `lsof` while a leak happened).

As the owner chose for the case where the slugify leak is not found: no change to a test and none to `.config/nextest.toml` (a leak is a pass; `result = "fail"` would turn about 1 test run in 128,000 of an OS race into a red build; a longer `leak-timeout` is rule 3's timeout raised to get green). D-19 records it, so a LEAK on a Mac is read as noise about the run and one in CI as a finding.

Refs: #58
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 2af1400 into main Nov 15, 2026
14 checks passed
@aRustyDev
aRustyDev deleted the docs/slugify-leak-hunt branch November 15, 2026 07:30
aRustyDev added a commit that referenced this pull request Nov 15, 2026
… into the OpenAPI Projects branch

#179 conflicted with main a third time, once the three small PRs it was opened with had merged. One conflict, `docs/src/testing/status.md`, and it is one hunk because G-25 and G-26 are adjacent rows: this branch changed G-25 only (the schema diff), #180 changed G-26 only (`THRUST_RL_CREATE_ID`). Checked by hash against the merge base (G-25 4337a2f968e5 on main and the base, 55eb907971f4 here; G-26 bb75219068af on the base and here, 104945eb6fb9 on main), so the resolution is this branch's G-25 row and main's G-26 row, and each now has exactly those hashes.

`.github/workflows/ci.yml` merged without a conflict: `deps` has the count guard's self-test, the release step and the OpenAPI step; `hermetic` has the count check and the OpenAPI tests; `lint` has the OpenAPI clippy. #182's D-19 row and #181's sentence in G-33 are in `status.md`, no conflict marker is left anywhere in the tree, and `cargo metadata --locked` resolves.

Refs: #58
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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