Skip to content

Port 4.1: Fix silent failures and optimize error short-circuit in multi-threaded tests (#17106) - #17865

Merged
normanmaurer merged 1 commit into
4.1from
test41
Oct 16, 2026
Merged

normanmaurer merged 1 commit into
4.1from
test41

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

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]

…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]>
@normanmaurer normanmaurer added this to the 4.1.140.Final milestone Oct 16, 2026
@normanmaurer
normanmaurer merged commit 988f65d into 4.1 Oct 16, 2026
18 of 19 checks passed
@normanmaurer
normanmaurer deleted the test41 branch October 16, 2026 13:06
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants