Repository navigation
fix(storage): complete active ranges when ObjectDescriptorImpl is cancelled - #16746
kalragauri wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates ObjectDescriptor and its implementation to ensure that destroying a descriptor cancels any unfinished reads, scheduling cancellation notifications on the completion queue rather than running them inline. To support this, MultiStreamManager introduces TakeActiveRanges(), and ObjectDescriptorImpl now accepts and utilizes a CompletionQueue. The feedback highlights a style guide violation regarding the use of default argument values in constructors within internal namespaces, which should be removed.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #16746 +/- ##
==========================================
+ Coverage 92.91% 92.92% +0.01%
==========================================
Files 2282 2282
Lines 232266 232653 +387
==========================================
+ Hits 215820 216204 +384
- Misses 16446 16449 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Destroying an
ObjectDescriptorwhile any range read started from it has not finished leavesAsyncReader::Read()hanging forever.~ObjectDescriptorImpl()callsObjectDescriptorImpl::Cancel()to cancel the underlying streams and then destroysstream_manager_, without ever callingReadRange::OnFinish(). Because stream callbacks hold weak pointers to the descriptor, nothing completes the orphanedReadRangeobjects once the descriptor is gone. AnyAsyncReaderdestroyed early on such a range also leaks itsDiscardbackground loop indefinitely because that loop keeps waiting onReadRange::Read().This change adds
MultiStreamManager::TakeActiveRanges()to detach all active ranges across all streams undermu_, passesAsyncConnectionImpl'sCompletionQueueintoObjectDescriptorImpl, and updatesObjectDescriptorImpl::Cancel()to complete every detached range withStatusCode::kCancelledafter releasingmu_. Notifications are scheduled throughCompletionQueue::MakeRelativeTimer(0ns)so pending read continuations and suspended coroutines run shortly after~ObjectDescriptor()returns on a completion-queue thread rather than inline inside the destructor, falling back to the destroying thread only when the queue has already been shut down. TheObjectDescriptorclass documentation now states this lifetime contract, and open read tracing spans now end withStatusCode::kCancelledinstead of staying open forever. CallingObjectDescriptorImpl::Read()afterCancel()on a live internal object is intentionally left unchanged because no public API exposesCancel()on a live descriptor, andObjectDescriptorReader::Cancel()for readers whose descriptor is still alive is left for a separate change.