Repository navigation
test(fast_io): IOCP disk-full simulation (#1932) - #4238
Merged
Merged
Conversation
Add deterministic disk-full coverage for the Windows IOCP disk-commit path. Real ERROR_DISK_FULL coverage on CI would require provisioning a fixed-size VHD or quota-bounded volume per test; both are heavyweight and flaky on hosted runners. Instead, surface a single-shot fault hook inside `IocpDiskBatch::submit_one_write` that returns a synthetic Win32 error code before any kernel call. The hook is dormant by default (a relaxed AtomicUsize load on the submit path) and exposed as `#[doc(hidden)]` so production callers never see it. The new integration test `crates/fast_io/tests/iocp_disk_full_simulation.rs` is cfg-gated to `windows + iocp`, so it compiles to nothing on Linux and macOS. Cases covered: - std maps Win32 ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39) onto io::ErrorKind::StorageFull on Rust 1.88. - First-submission fault during flush surfaces as StorageFull with the raw OS error intact, matching what the disk-commit thread reaps from a real WriteFile completion. - commit_file fault leaves a prior successfully-committed file on disk intact and lets Drop run cleanly with no panic and no port wedge. - Hook is single-shot: a second batch after the fault writes through end-to-end with no manual reset. - Nth-submission countdown lets the first two 4 KB chunks reach disk before faulting the third, so the file lands at exactly 8 KB.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Add deterministic disk-full coverage for the Windows IOCP disk-commit path. Real ERROR_DISK_FULL coverage on CI would require provisioning a fixed-size VHD or quota-bounded volume per test; both are heavyweight and flaky on hosted runners. Instead, surface a single-shot fault hook inside `IocpDiskBatch::submit_one_write` that returns a synthetic Win32 error code before any kernel call. The hook is dormant by default (a relaxed AtomicUsize load on the submit path) and exposed as `#[doc(hidden)]` so production callers never see it. The new integration test `crates/fast_io/tests/iocp_disk_full_simulation.rs` is cfg-gated to `windows + iocp`, so it compiles to nothing on Linux and macOS. Cases covered: - std maps Win32 ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39) onto io::ErrorKind::StorageFull on Rust 1.88. - First-submission fault during flush surfaces as StorageFull with the raw OS error intact, matching what the disk-commit thread reaps from a real WriteFile completion. - commit_file fault leaves a prior successfully-committed file on disk intact and lets Drop run cleanly with no panic and no port wedge. - Hook is single-shot: a second batch after the fault writes through end-to-end with no manual reset. - Nth-submission countdown lets the first two 4 KB chunks reach disk before faulting the third, so the file lands at exactly 8 KB.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Add deterministic disk-full coverage for the Windows IOCP disk-commit path. Real ERROR_DISK_FULL coverage on CI would require provisioning a fixed-size VHD or quota-bounded volume per test; both are heavyweight and flaky on hosted runners. Instead, surface a single-shot fault hook inside `IocpDiskBatch::submit_one_write` that returns a synthetic Win32 error code before any kernel call. The hook is dormant by default (a relaxed AtomicUsize load on the submit path) and exposed as `#[doc(hidden)]` so production callers never see it. The new integration test `crates/fast_io/tests/iocp_disk_full_simulation.rs` is cfg-gated to `windows + iocp`, so it compiles to nothing on Linux and macOS. Cases covered: - std maps Win32 ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39) onto io::ErrorKind::StorageFull on Rust 1.88. - First-submission fault during flush surfaces as StorageFull with the raw OS error intact, matching what the disk-commit thread reaps from a real WriteFile completion. - commit_file fault leaves a prior successfully-committed file on disk intact and lets Drop run cleanly with no panic and no port wedge. - Hook is single-shot: a second batch after the fault writes through end-to-end with no manual reset. - Nth-submission countdown lets the first two 4 KB chunks reach disk before faulting the third, so the file lands at exactly 8 KB.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
Add deterministic disk-full coverage for the Windows IOCP disk-commit path. Real ERROR_DISK_FULL coverage on CI would require provisioning a fixed-size VHD or quota-bounded volume per test; both are heavyweight and flaky on hosted runners. Instead, surface a single-shot fault hook inside `IocpDiskBatch::submit_one_write` that returns a synthetic Win32 error code before any kernel call. The hook is dormant by default (a relaxed AtomicUsize load on the submit path) and exposed as `#[doc(hidden)]` so production callers never see it. The new integration test `crates/fast_io/tests/iocp_disk_full_simulation.rs` is cfg-gated to `windows + iocp`, so it compiles to nothing on Linux and macOS. Cases covered: - std maps Win32 ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39) onto io::ErrorKind::StorageFull on Rust 1.88. - First-submission fault during flush surfaces as StorageFull with the raw OS error intact, matching what the disk-commit thread reaps from a real WriteFile completion. - commit_file fault leaves a prior successfully-committed file on disk intact and lets Drop run cleanly with no panic and no port wedge. - Hook is single-shot: a second batch after the fault writes through end-to-end with no manual reset. - Nth-submission countdown lets the first two 4 KB chunks reach disk before faulting the third, so the file lands at exactly 8 KB.
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.
Summary
crates/fast_io/tests/iocp_disk_full_simulation.rs, cfg-gated towindows + iocp, exercising the IOCP disk-commit path under simulatedERROR_DISK_FULL.#[doc(hidden)]single-shot fault hook inIocpDiskBatch::submit_one_writeso the test can deterministically inject Win32 error 112 without provisioning a limited-capacity volume on CI.ERROR_DISK_FULL(112) andERROR_HANDLE_DISK_FULL(39) toio::ErrorKind::StorageFullon Rust 1.88, so the existing transfer-layer fatal-error categorization fires automatically.Rationale
Real disk-full coverage on Windows would require a VHD or quota-bounded volume per test - heavyweight and flaky on hosted runners. Approach C from the design note (
docs/design/iocp-disk-full-tests.md) injects a synthetic Win32 error code at the submit boundary, which delivers byte-for-byte the same error path the kernel would return when the volume is full.The hook adds a single relaxed
AtomicUsizeload to the submit hot path and is excluded from the public API surface (#[doc(hidden)]on the module re-export).Test cases
std_maps_disk_full_codes_to_storage_full_kind- sanity check that std maps both 112 and 39 toStorageFull.first_submission_disk_full_surfaces_storage_full- flush propagates the injected error with the raw OS code intact.writer_drop_after_disk_full_is_clean- a previously committed file survives a later fault; Drop runs without panic or port wedge.batch_recovers_after_injected_fault_consumed- the hook is single-shot; a fresh batch writes through end-to-end.nth_submission_disk_full_skips_earlier_writes- countdown lets pre-fault chunks reach disk before the Nth submission fails.Test plan