googleapis / gax-java Public
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
fix: fix watchdog NPE red herring #1344
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1344 +/- ##
=========================================
Coverage 81.42% 81.43%
Complexity 1346 1346
=========================================
Files 211 211
Lines 5728 5730 +2
Branches 526 527 +1
=========================================
+ Hits 4664 4666 +2
Misses 851 851
Partials 213 213
Continue to review full report at Codecov.
|
callable1.call("request", observer); | ||
// This should cancel callable1 | ||
watchdog.run(); | ||
assertThat(callable1.popLastCall().getController().isCancelled()).isTrue(); |
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.
use of truth here feels gratuitous since assertTrue is simple and obvious
If CPU is overloaded, it's possible that the stream doesn't get started after idle timeout. In this case, innerController is not set and innerController.cancel() will throw NPE. The NPE is caught in
run()
and watchdog will still behave correctly, but the exception could be confusing. Adding a check to skip cancelIfStale to avoid the red herring.