Skip to content

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

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

fix(storage): do not close object descriptor span on reader completion#16321
bajajneha27 wants to merge 4 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 (e41509e) to head (db2efff).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16321      +/-   ##
==========================================
- Coverage   92.25%   92.24%   -0.01%     
==========================================
  Files        2227     2227              
  Lines      209234   209248      +14     
==========================================
- Hits       193024   193018       -6     
- Misses      16210    16230      +20     

☔ 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

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