GeezerVison is showing github.com — fix: prevent hanging by call backgroundResources.close() on stub.close() [ggj] by miraleung · Pull Request #804 · googleapis/sdk-platform-java
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Conversation
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…or-java into dev/stub-close
codecov
Bot
commented
Jul 30, 2021
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Merging #804 (e959ac1) into dev/try-catch-list (552af72) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@ Coverage Diff @@
## dev/try-catch-list #804 +/- ##
======================================================
+ Coverage 91.30% 91.32% +0.02%
======================================================
Files 140 140
Lines 15012 15050 +38
Branches 1086 1086
======================================================
+ Hits 13707 13745 +38
Misses 1009 1009
Partials 296 296
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 552af72...e959ac1. Read the comment docs.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…or-java into dev/stub-close
…or-java into dev/throw-cause
…or-java into dev/stub-close
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit hesitant originally, but giving it a closer look, seems like this PR really does the right thing: close() methods call close() underneath (instead of shutdown(), which was the old behavior). I mean shutdown() must call shutdown() for child resources, close() must call close() for child resources (instead of shutdown()), and this PR brings the generated code to that correct state.
Please address one comment about exception wraping before mergin.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
@Override
|
|
|
public final void close() {
|
|
|
shutdown();
|
|
|
try {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this (exception wrapping) exists solely because backgroundResources.close() is checked (throws Exception), but the EchoStub.close()is declared as non-checked, so we need do something like that for things to compile. Either way it will be a breaking behavioral change. To mitigate it, I think we can wrap only what we must (checked exceptions), but throw as is all the unchecked exceptions, so please consider generating somethign like this instead:
try {
backgroundResources.close();
} catch (RungimeException e) {
thrown e;
} catch (Exception e) {
throw new IllegalStateException("Failed to close resource", e);
}
}
This will let us to avoid unnecessary exception wrapping, making this change differ less from the previous behavior.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…r-java into dev/stub-close
miraleung
changed the title
fix: prevent hanging by call backgroundResources.close() on stub.close() [ggj]
fix: prevent hanging by calling backgroundResources.close() on stub.close() [ggj]
Aug 2, 2021
miraleung
changed the title
fix: prevent hanging by calling backgroundResources.close() on stub.close() [ggj]
fix: prevent hanging by call backgroundResources.close() on stub.close() [ggj]
Aug 2, 2021
…r-java into dev/stub-close
…rator-java into dev/stub-close
Reviewers
1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
cla: yes
This human has signed the Contributor License Agreement.
Milestone
No milestone
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.
|