Repository navigation
Port 4.1: Fix silent failures and optimize error short-circuit in multi-threaded tests (#17106) - #17865
Merged
Conversation
…ti-threaded 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]>
lltopk
pushed a commit
to lltopk/netty
that referenced
this pull request
Oct 24, 2026
…ti-threaded tests (netty#17106) (netty#17865) **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]> Co-authored-by: Rajan Chauhan <[email protected]> Co-authored-by: rajan chauhan <[email protected]>
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.
Motivation:
While
testReadOutputStreamMultipleThreadsandtestReadGatheringByteChannelMultipleThreadscaptured worker threaderrors inside an
AtomicReference, they only checked it iflatch.await()orbarrier.await()threw an exception. If the latchsuccessfully 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:
threads to instantly count down the remaining latch items upon
encountering a failure.
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]