Repository navigation
Return a completed result from BatchLogRecordProcessor#forceFlush after shutdown - #9083
Open
TimurRakhmatullin86 wants to merge 1 commit into
Open
TimurRakhmatullin86 wants to merge 1 commit into
TimurRakhmatullin86 wants to merge 1 commit into
Conversation
…er shutdown Same hang pattern as BatchSpanProcessor: after shutdown() the worker thread has flipped isShutdown and exited. A later call to forceFlush() CASes a fresh flushRequested and offers the signal, but nothing is left to drain it or call succeed() on the returned future. Guard the public forceFlush() with the worker's isShutdown atomic so it returns CompletableResultCode.ofSuccess() when the processor is already shut down. The internal Worker.forceFlush() path that shutdown() itself uses stays untouched, because shutdown() still needs the final flush after it sets isShutdown. Test: shutdown() first, then processor.forceFlush() returns an already-done successful result. Without the fix the result stays pending and the test blocks on the assertion.
Pull request dashboard statusWaiting on reviewers · refreshed 2026-11-30 17:02 UTC Review the latest changes. Status above doesn't look right?
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9083 +/- ##
============================================
- Coverage 90.52% 90.52% -0.01%
Complexity 11243 11243
============================================
Files 1039 1039
Lines 30678 30681 +3
Branches 4015 4015
============================================
+ Hits 27772 27774 +2
Misses 1928 1928
- Partials 978 979 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Same hang pattern as #9082 but in
BatchLogRecordProcessor.BatchLogRecordProcessor.forceFlush()invoked aftershutdown()returns aCompletableResultCodethat never completes:shutdown()runs:worker.shutdown()flipsisShutdownand setscontinueWork = false. The worker thread exits.processor.forceFlush()afterwards. It delegates toworker.forceFlush(), which CASesflushRequestedfromnullandsignal.offer(true).flushRequestedorsucceed()it. The future stays pending.join(),whenComplete(...).join(...)) wait until their own timeout.Fix
Mirror the no-op success behavior that
Worker.shutdown()already uses when called twice:The internal
Worker.forceFlush()thatWorker.shutdown()itself calls stays unchanged — the shutdown routine still runs its final flush even after it setsisShutdown = true.Test
forceFlushAfterShutdownCompletesshuts the processor down, then callsforceFlush()and verifies the returned result is already done and successful. Without the fix the result stays pending and the test blocks on the assertion.