You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BlockWriter::new() opens replicas sequentially. If an earlier WriterAdapter::new() succeeds but a later replica open fails, the ? operator returns immediately without explicitly cancelling writers that were already opened:
Opening a local or remote writer can already create Worker-side writing metadata, staging storage, and reserved-capacity accounting. Dropping WriterAdapter is not a sufficient cleanup contract because cancellation requires asynchronous local/remote operations. A partial-open failure can therefore leave resources associated with the replicas that opened successfully.
This is independent of worker.free_ratio, although strict space admission can make the sequence easier to trigger when an earlier replica opens and a later replica returns DiskOutOfSpace.
To Reproduce
Allocate a block with at least two replica locations.
Allow the first replica's WriterAdapter::new() to complete successfully.
Inject an open failure for a later replica, for example a storage-capacity rejection or RPC failure.
Observe that BlockWriter::new() returns the later open error without explicitly calling cancel() on the earlier writer.
Inspect the earlier Worker for writing metadata, staging data, the active write context, and reserved bytes.
Expected behavior
When a later replica fails to open, BlockWriter::new() should:
Best-effort cancel every writer that was opened earlier in the same construction attempt.
Attempt all cancellations even if one cancellation fails.
Preserve the original replica-open error as the primary returned error.
Log or attach cleanup failures without replacing the original error.
Never cancel writers after all replicas open successfully.
Screenshots
Not applicable.
OS Version (please complete the following information):
OS: platform-independent client lifecycle issue; validate on Linux
Curvine version/branch: current main
Relevant configuration: block replication greater than one; no specific storage backend required
Additional context
Relevant code: crates/client/curvine-client-core/src/block/block_writer.rs, in BlockWriter::new().
Tests should cover local, remote, and mixed writer combinations; cancellation failure; original-error preservation; and cleanup of staging metadata/files and reserved bytes.
Describe the bug
BlockWriter::new()opens replicas sequentially. If an earlierWriterAdapter::new()succeeds but a later replica open fails, the?operator returns immediately without explicitly cancelling writers that were already opened:Opening a local or remote writer can already create Worker-side writing metadata, staging storage, and reserved-capacity accounting. Dropping
WriterAdapteris not a sufficient cleanup contract because cancellation requires asynchronous local/remote operations. A partial-open failure can therefore leave resources associated with the replicas that opened successfully.This is independent of
worker.free_ratio, although strict space admission can make the sequence easier to trigger when an earlier replica opens and a later replica returnsDiskOutOfSpace.To Reproduce
WriterAdapter::new()to complete successfully.BlockWriter::new()returns the later open error without explicitly callingcancel()on the earlier writer.Expected behavior
When a later replica fails to open,
BlockWriter::new()should:Screenshots
Not applicable.
OS Version (please complete the following information):
mainAdditional context
crates/client/curvine-client-core/src/block/block_writer.rs, inBlockWriter::new().