Drain sink on stream destroy + destroy run-out test#1
Closed
nclack wants to merge 2 commits into
Closed
Conversation
Owner
Author
|
Superseded by acquire-project#158 (PR retargeted to upstream). |
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.
Closes acquire-project#147.
Closes acquire-project#152.
acquire-project#147 — flush error paths can free footer_buf with sink IO still pending (both backends)
writer_flushdrains the sink IO queue only afterfinalize_shards. If the flush body errors between queueing a footer-referencingwrite_directjob and reaching the drain (e.g. a truncate/metadata-write failure afterfinalize_shardshas queued footer jobs), it returns early without draining. Stream destroy then freesfooter_buf_poolwhile the IO worker may still be parked before the write — the acquire-project#145 use-after-free / on-disk-corruption class, behind an error precondition.Fix: drain unconditionally on the destroy path of both backends, before the teardown that frees the footer pool — mirroring how acquire-project#142 made gate release unconditional on destroy.
shard_sink_drainintile_stream_gpu_destroybeforeengine_array_state_destroy.shard_sink_drainintile_stream_cpu_destroybefore theshard_state_destroyloop.New regression test
tests/test_flush_error_drain_cpu.c(CPU-only): injects a one-shot failing truncate (newshard_pool_fs_inject_failing_truncatehook) so footer jobs stay queued when destroy runs; under ASAN, no use-after-free is the pass condition.acquire-project#152 — test_destroy_midstream does not exercise the teardown run-out path
Both existing subtests auto-flush successfully before destroy, so the GPU worker queue is already empty when
gpu_delivery_stop_joinruns — the run-out line is verified by reasoning only.New subtest forces a delivery to stay queued at destroy time by marking the pool errored up front (new synchronous
shard_pool_fs_set_errorhook), so every delivery short-circuits onhas_error; then destroys from another thread and asserts no hang and no use-after-free under ASAN.The two fault-injection helpers (
inject_failing_truncate, one-shot/truncate-triggered;set_error, synchronous) are distinct and serve the two tests; both land here together.