fix(storage): prevent indefinite hang when calling Close() on async appendable uploads#16255
fix(storage): prevent indefinite hang when calling Close() on async appendable uploads#16255kalragauri wants to merge 1 commit into
Conversation
…ppendable uploads
There was a problem hiding this comment.
Code Review
This pull request updates AsyncWriterConnectionImpl::OnClose to perform an asynchronous Read and OnQuery check before finishing the connection, and updates the corresponding unit and integration tests. A critical lifetime issue was identified in the new asynchronous chain, where capturing this by raw pointer in the .then() continuations could lead to a use-after-free if the connection object is destroyed before the chain completes. It is recommended to capture a shared pointer via shared_from_this() to extend the lifetime of the connection object.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16255 +/- ##
==========================================
- Coverage 92.26% 92.26% -0.01%
==========================================
Files 2214 2214
Lines 206307 206326 +19
==========================================
+ Hits 190355 190371 +16
- Misses 15952 15955 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Currently, when closing an appendable upload, the SDK delegates a
kFlushAndClosesignal to the underlying gRPC stream. However, inwriter_connection_impl.cc, the caller was invokingFinish()immediately after flushing the write, failing to consume the server's final BidiWriteObjectResponse which effectively hangs the stream on the completion queue. This PR fixes the behavior to properly abide by the gRPC stream contract.