Skip to content

[common] Close async output streams when writer cleanup is interrupted - #11558

Open
zhangyue19921010 wants to merge 2 commits into
apache:masterfrom
zhangyue19921010:contrib/close-interrupted-async-output
Open

zhangyue19921010 wants to merge 2 commits into
apache:masterfrom
zhangyue19921010:contrib/close-interrupted-async-output

Conversation

@zhangyue19921010

Copy link
Copy Markdown
Contributor

Purpose

Fixes #11557.

Aborting an async file writer from an already interrupted thread can fail to enqueue its end event. The background worker then keeps polling with the underlying stream open. Use a nonblocking enqueue on the unbounded event queue so cleanup reaches the worker while retaining the caller's interrupt status.

Tests

Added real-file SingleFileWriter regressions for interrupted abort with empty and buffered output. Both fail on the unchanged base because the stream stays open. The writer and async output stream test classes pass with the fix, including normal writes, flushes and error propagation, with the normal Maven quality checks enabled (JDK 11).

Only the end event must survive interruption. Data and flush events still fail
an interrupted writer, so a cancelled compaction stops writing, and the failure
also ends the worker.
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.

[Bug] Interrupted async writer cleanup leaves output streams open

1 participant