Repository navigation
fix(fast_io): carry the kernel's ErrorKind out of a failed buffer registration - #7619
Merged
Merged
Conversation
…istration
`Feature flag combinations / io_uring (linux)` fails intermittently on
`drop_on_construction_failure_does_not_double_register`:
ring must be reusable after a failed registration was cleaned up (the
rejected second `new` reported IORING_REGISTER_BUFFERS failed: Device or
resource busy (os error 16)); the fresh `new` reported ... Cannot allocate
memory (os error 12)
Two independent defects, and the first is why the second could not be fixed.
1. `registry.rs` built the failure with `io::Error::other`, which pins the kind
to `Other` whatever the kernel said. The errno survived only inside the
message string, so no caller could branch on it - ENOMEM (the locked-memory
budget could not account the pages) and EBUSY (a registration is still live)
were indistinguishable to code. Now the error carries `e.kind()`.
2. The reuse probe then asserted `third.is_ok()` unconditionally, while the
three guards above it - `try_ring`, `try_group`, and the replace-semantics
arm - all skip when the kernel cannot host the probe. It was the one step
with no environment tolerance, and it had none available: without (1) there
was no kind to test. It now splits on the reason:
Ok the contract holds
ENOMEM RLIMIT_MEMLOCK could not account the pages; registration never
happened, so this says nothing about failure recovery. Skip.
other EBUSY in particular means a registration is STILL LIVE after a
successful `unregister` - the dangling kernel state this test
exists to catch. Still a hard failure.
This is not a waiver: the EBUSY contract is unchanged, and the assertion that
was doing the work still fails.
The three pre-existing skip arms now say they skipped. Silent skips are how a
0.006s "1 passed" reads as coverage when it is a no-op - measured on a kernel
with replace-update semantics, where the failure-recovery branch is
structurally unreachable and this test cannot assert anything.
Non-vacuity, measured on Linux by restoring `io::Error::other` and re-running:
assertion `left != right` failed: a failed registration must carry the
kernel ErrorKind, not the opaque `Other` that hides ENOMEM from EBUSY:
Custom { kind: Other, error: "IORING_REGISTER_BUFFERS failed: Cannot
allocate memory (os error 12)" }
1 test run: 0 passed, 1 failed
and green again with the fix restored. That also confirms the kernel really
does answer ENOMEM here, which is what the CI failure reported.
Verified on Linux: `cargo fmt --all -- --check` clean; `cargo clippy -p fast_io
--features io_uring --all-targets -- -D warnings` clean; both drop_contract
tests pass.
⚠ NOT verified: the failing CI path itself. It needs a kernel that REFUSES
double registration with EBUSY; the available Linux host accepts replace-style
re-registration, so the probe is unreachable there and cannot be reproduced.
The guard is derived from the CI failure's own reported errno, not from a
local repro.
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.
Why
Feature flag combinations / io_uring (linux)is the single failing check on #7615, the PR that clears the master red for six others. The failure is pre-existing and unrelated to #7615 — that cell runs-p transfer -p fast_io, and #7615's only changed file is a root integration test outside that package scope.Two defects, and the first is why the second had no fix available
1. The errno was discarded.
registry.rs:222built the failure withio::Error::other(...), pinning the kind toOtherwhatever the kernel said. The errno survived only inside the message string, so no caller could branch on it — ENOMEM (the locked-memory budget could not account the pages) and EBUSY (a registration is still live) were indistinguishable to code. It now carriese.kind().2. The reuse probe had no environment tolerance — and could not have had one, because there was no kind to test. Its three sibling guards (
try_ring,try_group, the replace-semantics arm) all skip when the kernel cannot host the probe; the final assert was the only step that didn't. It now splits on the kernel's reason:OkENOMEMRLIMIT_MEMLOCKcould not account the pages; registration never happenedunregisterThis is not a waiver. The EBUSY contract is unchanged and the assertion that was doing the work still fails.
The skip arms now say they skipped
Silent skips are how a 0.006s "1 passed" reads as coverage when it is a no-op. Measured: on a kernel with replace-update semantics (5.13+) the second
newsucceeds, the test returns early through its own documented arm, and the failure-recovery branch is structurally unreachable — it asserts nothing. Each arm now prints why.Non-vacuity — mutation-proven on Linux
Restoring
io::Error::otherand re-running:Green again with the fix restored. That also independently confirms the kernel answers ENOMEM here — the same errno CI reported.
Verified / not verified
Verified on Linux:
cargo fmt --all -- --checkclean;cargo clippy -p fast_io --features io_uring --all-targets -- -D warningsclean; bothdrop_contracttests pass; the mutation above is lethal.⚠ Not verified: the failing CI path itself. Reaching it needs a kernel that refuses double registration with EBUSY. The available Linux host accepts replace-style re-registration, so the probe is unreachable there. The guard is derived from the CI failure's own reported errno, not from a local repro — stated plainly because that is the limit of the evidence.