Skip to content

fix(bigquery): avoid panic on idle stream shutdown - #6816

Merged
dbolduc merged 3 commits into
googleapis:mainfrom
dbolduc:fix-bq-write-stream-error-panic
Sep 15, 2026
Merged

dbolduc merged 3 commits into
googleapis:mainfrom
dbolduc:fix-bq-write-stream-error-panic

Conversation

@dbolduc

@dbolduc dbolduc commented Sep 15, 2026

Copy link
Copy Markdown
Member

The server always sends one response per request... but it can also end the stream in an error without any requests in the queue. We need to account for this.

Fixes #6815

@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the BigQuery API. label Sep 15, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the BigQuery write runner to gracefully handle idle stream closures when no requests are queued, preventing panics from popping an empty response queue. It also adds a regression test to verify this behavior. The feedback suggests refactoring the conditional block using a let-else statement to return early, which simplifies the logic and aligns with the repository's style guide.

Comment thread src/bigquery/src/write/runner.rs Outdated
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.03%. Comparing base (bcefaf4) to head (283c51e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6816   +/-   ##
=======================================
  Coverage   97.02%   97.03%           
=======================================
  Files         326      326           
  Lines      107548   107569   +21     
=======================================
+ Hits       104348   104375   +27     
+ Misses       3200     3194    -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.

@dbolduc
dbolduc marked this pull request as ready for review September 15, 2026 14:08
@dbolduc
dbolduc requested a review from a team as a code owner September 15, 2026 14:08
@dbolduc
dbolduc enabled auto-merge (squash) September 15, 2026 14:16
@dbolduc
dbolduc merged commit 74cda3e into googleapis:main Sep 15, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the BigQuery API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BQ Write: Client library can panic on stream errors.

2 participants