-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix gRPC stream observer leak on ProcessBundleHandler shutdown #39390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -767,6 +767,7 @@ public BeamFnApi.InstructionResponse.Builder trySplit(InstructionRequest request | |
| /** Shutdown the bundles, running the tearDown() functions. */ | ||
| public void shutdown() throws Exception { | ||
| bundleProcessorCache.shutdown(); | ||
| beamFnDataClient.close(); | ||
| } | ||
|
Comment on lines
768
to
771
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If public void shutdown() throws Exception {
try {
bundleProcessorCache.shutdown();
} finally {
beamFnDataClient.close();
}
}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this may be overly defensive. close is always best effort. Currently |
||
|
|
||
| @VisibleForTesting | ||
|
|
||
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.
BeamFnDataGrpcClient is created in FnHarness.main:
beam/sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnHarness.java
Line 335 in 39c60f0
and ownership passed to ProcessBundleHandler:
beam/sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnHarness.java
Line 371 in 39c60f0
Therefore we should close it here.
When FnHarness.main is invoked multiple times (instead of as a standalone worker like on Dataflow runner), previously unclosed BeamFnDataGrpcClient leak gRPC streams