Repository navigation
Auto-port 5.0: Fix silent failures and optimize error short-circuit in multi-threaded tests - #17156
Merged
Merged
Conversation
…d tests (#17106) **Motivation**: While `testReadOutputStreamMultipleThreads` and `testReadGatheringByteChannelMultipleThreads` captured worker thread errors inside an `AtomicReference`, they only checked it if `latch.await()` or `barrier.await()` threw an exception. If the latch successfully hit zero, any recorded worker thread failures were silently ignored, causing failing tests to pass. Furthermore, when a thread failed, other worker threads would keep spinning needlessly instead of short-circuiting. **Modifications**: - Added a short-circuit loop inside the catch block of the worker threads to instantly count down the remaining latch items upon encountering a failure. - Added an explicit post-await check to look for captured exceptions and cleanly rethrow them out of the main thread using `AssertionError`. **Result**: Multi-threaded test failures are now instantly short-circuited and correctly reported back to the test runner instead of failing silently. Co-authored-by: rajan chauhan <[email protected]> (cherry picked from commit 2eb5be1)
✅ All tests passed ✅Test SummaryBuild PR / windows-x86_64-java25-boringssl > Netty/Buffer
🏷️ Commit: 6c3ffa1 Test FailuresReadOnlyByteBufferBufTest > testCopyMultipleThreads() (Netty/Buffer in Build PR / windows-x86_64-java25-boringssl)Learn more about TestLens at testlens.app. |
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.
Auto-port of #17106 to 5.0
Cherry-picked commit: 2eb5be1
Motivation:
While
testReadOutputStreamMultipleThreadsandtestReadGatheringByteChannelMultipleThreadscaptured worker thread errors inside anAtomicReference, they only checked it iflatch.await()orbarrier.await()threw an exception. If the latch successfully hit zero, any recorded worker thread failures were silently ignored, causing failing tests to pass. Furthermore, when a thread failed, other worker threads would keep spinning needlessly instead of short-circuiting.Modifications:
AssertionError.Result:
Multi-threaded test failures are now instantly short-circuited and correctly reported back to the test runner instead of failing silently.