Skip to content

fix(storage): do not close object descriptor span on reader completion - #16321

Open
bajajneha27 wants to merge 7 commits into
googleapis:mainfrom
bajajneha27:542034919
Open

fix(storage): do not close object descriptor span on reader completion#16321
bajajneha27 wants to merge 7 commits into
googleapis:mainfrom
bajajneha27:542034919

Conversation

@bajajneha27

@bajajneha27 bajajneha27 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem
AsyncObjectDescriptorConnectionTracing::Read() was wrapping the returned reader in MakeTracingReaderConnection(span_, ...). AsyncReaderConnectionTracing ends the span as soon as the reader stream finishes. Because span_ represents the storage::AsyncConnection::Open span, it was ending prematurely on the first range completion instead of staying active for the lifetime of ObjectDescriptorConnection.

Fix
Returned impl_->Read(p) directly in AsyncObjectDescriptorConnectionTracing::Read(). Individual range reads are already traced by ObjectDescriptorImpl::Read(), which creates MakeTracingObjectDescriptorReader() when tracing is enabled.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Aug 5, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the Read method in AsyncObjectDescriptorConnectionTracing by returning the result of impl_->Read(p) directly instead of wrapping it in a tracing reader connection. It also updates the corresponding unit tests to verify single and multiple read ranges, ensuring the open span is not prematurely ended. The review feedback suggests a safer and more idiomatic C++ approach in the tests by using std::make_unique and a mutable lambda capture instead of raw pointers to prevent potential memory leaks.

Comment thread google/cloud/storage/internal/async/object_descriptor_connection_tracing_test.cc Outdated
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.24%. Comparing base (c49c86f) to head (09fd4ca).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16321   +/-   ##
=======================================
  Coverage   92.23%   92.24%           
=======================================
  Files        2227     2227           
  Lines      209169   209203   +34     
=======================================
+ Hits       192929   192969   +40     
+ Misses      16240    16234    -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bajajneha27
bajajneha27 marked this pull request as ready for review August 5, 2026 11:41
@bajajneha27
bajajneha27 requested review from a team as code owners August 5, 2026 11:41

@v-pratap v-pratap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was running a few experiments, and with the previous code I ran the Open of async and I got the trace, attached in the screenshot. I think it is correct and expected behaviour, Can you add a screenshot of trace before and after this PR change. And please let me know if my understanding is wrong. Also the error(red bar) is expected.
Trace: link

Image

@bajajneha27

bajajneha27 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for sharing the image.
Here's the image before the changes:

Screenshot 2026-08-06 at 09 48 41

Notice that the Open span is ending before the last ReadRange span.

Image after the changes:

Screenshot 2026-08-06 at 09 50 12

Let's discuss this in our sync today.

@bajajneha27
bajajneha27 requested a review from v-pratap August 6, 2026 04:27
@bajajneha27 bajajneha27 added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 6, 2026
@bajajneha27 bajajneha27 removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants