This repository was archived by the owner on Feb 24, 2026. It is now read-only.
fix:shutdown stuck when there is error on the flush path#831
Merged
stephaniewang526 merged 2 commits intogoogleapis:masterfrom Feb 16, 2021
yirutang:fix1
Merged
fix:shutdown stuck when there is error on the flush path#831stephaniewang526 merged 2 commits intogoogleapis:masterfrom yirutang:fix1
stephaniewang526 merged 2 commits intogoogleapis:masterfrom
yirutang:fix1
Conversation
…l to release the requests in the queue, causing shutdown to wait forever
Codecov Report
@@ Coverage Diff @@
## master #831 +/- ##
============================================
+ Coverage 81.10% 81.14% +0.04%
Complexity 996 996
============================================
Files 74 74
Lines 5346 5347 +1
Branches 415 415
============================================
+ Hits 4336 4339 +3
+ Misses 839 838 -1
+ Partials 171 170 -1
Continue to review full report at Codecov.
|
stephaniewang526
approved these changes
Feb 16, 2021
yayi-google
reviewed
Feb 16, 2021
| public void onError(Throwable t) { | ||
| LOG.fine("OnError called"); | ||
| if (streamWriter.shutdown.get()) { | ||
| abortInflightRequests(t); |
Contributor
There was a problem hiding this comment.
There are two more issues:
- Even if you abort the inflight request here, the shutdown can still add more requests through writeAllOutstanding();
- Besides, it is also possible that another thread is calling append, and will contribute another stuck request at https://screenshot.googleplex.com/7pmsyb2zyKDEaGF
yayi-google
reviewed
Feb 16, 2021
...igquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java
Outdated
Show resolved
Hide resolved
yayi-google
reviewed
Feb 16, 2021
|
|
||
| ApiFuture<AppendRowsResponse> appendFuture1 = sendTestMessage(writer, new String[] {"A"}); | ||
| ApiFuture<AppendRowsResponse> appendFuture2 = sendTestMessage(writer, new String[] {"B"}); | ||
| Thread.sleep(5000L); |
| Thread.sleep(5000L); | ||
| fakeExecutor.advanceTime(Duration.ofSeconds(20)); | ||
| // Shutdown writer immediately and there will be some error happened when flushing the queue. | ||
| writer.shutdown(); |
Contributor
There was a problem hiding this comment.
I don't understand this. You advance the time before shutdown. So even in the old code path before your fix, you can reduce the only inflight requests in the queue and unblock. Will this unit test block before your fix?
Please think carefully how to write a unit test.
shubhwip
pushed a commit
to shubhwip/java-bigquerystorage
that referenced
this pull request
Oct 7, 2023
🤖 I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…l to release the requests in the queue, causing shutdown to wait forever
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> ☕️