fix: shutdown blocks for unary deadline time - #1848
Conversation
toddbaert
commented
Sep 11, 2026
- an earlier refactor changed the way the shutdown works, in order to remove a sleep
- resulted in incorrect order of some method calls in shutdown - we need to await AFTER we kill the channel
- without this fix, we always awaited for the configured unary RPC deadline before actually closing the channel
* an earlier refactor changed the way the shutdown works, in order to remove a sleep * resulted in incorrect order of some method calls in shutdown - we need to await AFTER we kill the channel * without this fix, we always awaited for the configured unary RPC deadline before actually closing the channel Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe shutdown methods now close channel connectors before awaiting retry scheduler termination. A regression test verifies that an active sync stream cancels and shutdown completes within the configured timeout. ChangesShutdown ordering
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Shutdown now completes promptly for active streams, with regression coverage for the ordering fix. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
| retryScheduler.shutdownNow(); | ||
| // shut the channel down before awaiting | ||
| grpcComponents.channelConnector.shutdown(); | ||
| ShutdownUtils.awaitTerminationQuietly( | ||
| () -> retryScheduler.awaitTermination(deadline, TimeUnit.MILLISECONDS)); | ||
| grpcComponents.channelConnector.shutdown(); |
There was a problem hiding this comment.
This ordering is wrong - we wait first, and then shutdown (this was due to a refactor which didn't correctly re-order these).
Obviously, we need to shut down the channel and then wait.
| verify(stub, times(2)).syncFlags(any(), any()); | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
This test fails without the fix. I also verified the bug and fix manually.