Backport [Java] Observe error to avoid crash (#22016) #24843
Merged
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.
Description
Ungraceful disconnects can cause the Java application to crash. The cause is similar to how UnobservedTaskException's would crash the process in .NET. In the Java client there was a case where there was an exception and we would not observe it which crashes the process. The fix is to avoid causing the exception in the first place so there isn't an unobserved error.
Customer Impact
The bug was reported by a customer in issue #20187 and also by an internal customer recently who is asking us to backport the fix.
The bug can cause occasional crashes for ungraceful disconnects, these can be caused by things like going through a tunnel, etc.
Regression?
No
Risk
Low, fix is small and unlikely to cause issues.