Skip to content

Auto-port 5.0: Fix silent failures and optimize error short-circuit in multi-threaded tests - #17156

Merged
chrisvest merged 1 commit into
5.0from
auto-port-pr-17106-to-5.0
Jul 27, 2026
Merged

chrisvest merged 1 commit into
5.0from
auto-port-pr-17106-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #17106 to 5.0
Cherry-picked commit: 2eb5be1


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.

…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)
@testlens-app

testlens-app Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

✅ All tests passed ✅

⚠️ TestLens detected flakiness ⚠️

Test Summary

Build PR / windows-x86_64-java25-boringssl > Netty/Buffer

Test Runs Flakiness
ReadOnlyByteBufferBufTest > testCopyMultipleThreads() ⚠️ 0% 🟢

🏷️ Commit: 6c3ffa1
▶️ Tests: 13319 executed
⚪️ Checks: 12/12 completed

Test Failures

ReadOnlyByteBufferBufTest > testCopyMultipleThreads() (Netty/Buffer in Build PR / windows-x86_64-java25-boringssl)
java.util.concurrent.TimeoutException
	at java.base/java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:259)
	at java.base/java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:437)
	at io.netty.buffer.AbstractByteBufTest$31.run(AbstractByteBufTest.java:2379)
	at java.base/java.lang.Thread.run(Thread.java:1474)

Learn more about TestLens at testlens.app.

@chrisvest chrisvest added this to the 5.0.0.Final milestone Jul 27, 2026
@chrisvest
chrisvest merged commit 6c641b5 into 5.0 Jul 27, 2026
12 of 13 checks passed
@chrisvest
chrisvest deleted the auto-port-pr-17106-to-5.0 branch July 27, 2026 19:23
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.

3 participants