GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SingleThreadEventExecutor: do not start threads when shutting down never-used executors by arimu1 · Pull Request #17183 · netty/netty

Conversation

@arimu1

@arimu1 arimu1 commented Aug 1, 2026

Copy link
Copy Markdown

Motivation:

MultithreadEventExecutorGroup.shutdownGracefully() (and therefore
MultiThreadIoEventLoopGroup) calls shutdownGracefully on every child
executor. Each child is a lazily started SingleThreadEventExecutor.

shutdown0() always called ensureThreadStarted() for
ST_NOT_STARTED, which spun up a worker thread solely so it could exit
on the normal shutdown path. Constructing a large unused group and
shutting it down therefore started every thread:

EventLoopGroup group = new MultiThreadIoEventLoopGroup(300, NioIoHandler.newFactory());
group.shutdownGracefully(); // previously started 300 threads

See #17135.

Modification:

In SingleThreadEventExecutor.ensureThreadStarted(), when the prior
state was ST_NOT_STARTED and there is no pending work (empty task
queue, no scheduled tasks, no shutdown hooks), transition directly to
ST_TERMINATED under the processing lock and complete
terminationFuture without creating a thread.

If work is present (or the processing lock is already held by a worker),
fall back to the existing doStartThread() path so tasks still run and
shutdown hooks still execute.

Result:

Fixes #17135.

  • Unused group / never-started executor shutdown no longer creates threads
  • Submit-then-shutdown still starts a thread and runs the task
  • Regression tests in SingleThreadEventExecutorTest

Tested: ./mvnw -pl common test -Dtest=SingleThreadEventExecutorTest (18/18 green, JDK 21)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@arimu1

arimu1 commented Aug 2, 2026

Copy link
Copy Markdown
Author

Local verification (Temurin 21):

./mvnw -pl common -Dtest=SingleThreadEventExecutorTest test
# Tests run: 18, Failures: 0, Errors: 0, Skipped: 0

CI failures on this run look environmental rather than regressions of #17135:

  • linux-*: java.lang.OutOfMemoryError: Java heap space during the common test suite (not assertion failures in SingleThreadEventExecutorTest).
  • macos KQueue*: native KQueue suite failures (including pre-existing-style detect-peer-close / event-loop tests). SingleThreadEventExecutorTest itself is green locally.

Happy to re-run CI / dig further if maintainers see a real regression path.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Aug 3, 2026

Copy link
Copy Markdown
Member

@arimu1 there are multiple test failures... please check and let me know once you fixed these

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arimu1

arimu1 commented Aug 3, 2026

Copy link
Copy Markdown
Author

@normanmaurer Thanks — dug into the TestLens / CI failures. They were real regressions from this PR, not only env OOM.

Root cause

tryTerminateIfNeverStarted() called cleanup() without an event-loop thread. SingleThreadIoEventLoop.cleanup() asserts inEventLoop() and destroys the constructor-created IoHandler:

java.lang.AssertionError
  at SingleThreadIoEventLoop.cleanup(...)
  at SingleThreadEventExecutor.tryTerminateIfNeverStarted(...)
  at ...shutdownGracefully / MultithreadEventExecutorGroup.shutdownGracefully

That hit every IoEventLoop suite that shuts down never-started children (KQueue, Nio, AbstractSingleThreadEventLoopTest.shutdown*BeforeStart, etc.).

Fix (latest push)

  1. Bind current thread for the never-started cleanup() so IoHandler / native FDs are destroyed without starting a worker.
  2. Only take the no-thread fast-path when gracefulShutdownQuietPeriod == 0 (preserve graceful quiet-period task acceptance, e.g. testGracefulShutdownQuietPeriod).
  3. MultithreadEventExecutorGroup.shutdownGracefully forces quietPeriod/timeout 0 for never-started children so default group.shutdownGracefully() still avoids spinning up unused workers (Shutting down MultiThreadIoEventLoopGroup starts all unstarted threads #17135).

Local verification (Temurin 21)

  • ./mvnw -pl common -Dtest=SingleThreadEventExecutorTest test → 18/18
  • ./mvnw -pl transport -Dtest=SingleThreadEventLoopTest,SingleThreadIoEventLoopTest,NioEventLoopTest test → 34 tests, 0 failures (1 skip)

Rebased onto latest 4.2. Please re-check CI when convenient.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arimu1
arimu1 force-pushed the fix/17135-shutdown-unstarted-threads branch from f4286c9 to d515a51 Compare August 3, 2026 23:55
@mega12345mega

mega12345mega commented Aug 4, 2026

Copy link
Copy Markdown

From scrolling through the changes, it is not clear to me if this situation is handled correctly:

EventLoopGroup group = new MultiThreadIoEventLoopGroup(300, NioIoHandler.newFactory());
group.shutdownGracefully(100, 100, TimeUnit.MILLISECONDS);
Thread.sleep(10); // Wait for threads to transition directly to terminated
group.execute(...); // Within grace period so should be executed

I may be misunderstanding how the grace period is intended to work or missed something.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arimu1

arimu1 commented Aug 4, 2026

Copy link
Copy Markdown
Author

@mega12345mega Good catch — that scenario is handled by design for #17135, not by accepting late tasks on never-started children.

What happens with your snippet

EventLoopGroup group = new MultiThreadIoEventLoopGroup(300, NioIoHandler.newFactory());
group.shutdownGracefully(100, 100, TimeUnit.MILLISECONDS);
Thread.sleep(10);
group.execute(...);
  1. MultithreadEventExecutorGroup.shutdownGracefully forces quietPeriod=0, timeout=0 on children where isNeverStarted() is true, so they can terminate without creating workers (Shutting down MultiThreadIoEventLoopGroup starts all unstarted threads #17135).
  2. After a few ms those unused children are TERMINATED.
  3. group.execute → next().execute then rejects (RejectedExecutionException) rather than starting a thread just to run a shutdown-window task.

Why not honor the caller's 100ms quiet period on unused children?

Accepting tasks during the quiet period requires a running event-loop thread. Starting all 300 workers on shutdown is exactly what this PR avoids. Already-started children still get the full quietPeriod/timeout and accept late tasks until the quiet period elapses.

Single-executor path

A lone SingleThreadEventExecutor.shutdownGracefully(100, …) with a never-started executor still starts a thread when quiet period is non-zero (fast-path only when quietPeriod == 0).

Docs + test

Pushed javadoc on MultithreadEventExecutorGroup.shutdownGracefully and
testGroupShutdownNonZeroQuietPeriodRejectsExecuteOnNeverStartedChildren documenting the contract. Full SingleThreadEventExecutorTest 19/19 green locally.

If maintainers prefer that non-zero group quiet periods still start never-used children so late execute works, we can drop the force-(0,0) path — but that reverts the #17135 benefit for large unused groups.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mega12345mega

mega12345mega commented Aug 4, 2026

Copy link
Copy Markdown

The concern is for the case where none of the threads in a MultiThreadIoEventLoopGroup have been started yet, so they all become terminated immediately, so it is unable to handle the task. Ideally the SingleThreadEventExecutor would be able to transition into a shutting-down-esc state where the thread is not yet started but can be, something like this:

Thread is running beforehand: ST_STARTED -> [shutdown] -> ST_SHUTTING_DOWN -> [end of grace period] -> ST_SHUTDOWN

Thread isn't running and doesn't receive task: ST_NOT_STARTED -> [shutdown] -> ST_UNSTARTED_SHUTDOWN (variant of ST_SHUTTING_DOWN) -> [end of grace period] -> ST_SHUTDOWN

Thread isn't running and does receive task: ST_NOT_STARTED -> [shutdown] -> ST_UNSTARTED_SHUTDOWN -> [task received] -> ST_SHUTTING_DOWN -> [end of grace period] -> ST_SHUTDOWN

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

arimu1 added a commit to arimu1/netty that referenced this pull request Aug 4, 2026
@arimu1
SingleThreadEventExecutor: honor quiet period for never-started children
ffaa9bf
Never-started executors with a non-zero quiet period stay SHUTTING_DOWN
without starting a worker, schedule a GlobalEventExecutor timer to
terminate when quiet elapses with no work, and start a worker only if
execute() arrives during the quiet period. MultithreadEventExecutorGroup
no longer forces quietPeriod=0 on unused children.

Addresses mega12345mega's design feedback on netty#17183 / netty#17135.

Signed-off-by: arimu1 <[email protected]>
@arimu1

arimu1 commented Aug 4, 2026

Copy link
Copy Markdown
Author

@mega12345mega Implemented the design you sketched for never-started + quiet period:

  • Never-started + quietPeriod == 0: still terminate without starting a worker (Shutting down MultiThreadIoEventLoopGroup starts all unstarted threads #17135).
  • Never-started + quietPeriod > 0: transition to ST_SHUTTING_DOWN without a worker; schedule a GlobalEventExecutor timer. Idle children terminate when quiet elapses with no tasks. execute() during the quiet window starts only that child under ST_SHUTTING_DOWN.
  • MultithreadEventExecutorGroup: no longer forces (0,0) on unused children — the caller's quiet period is honored.

Tests:

  • testGroupShutdownNonZeroQuietPeriodAcceptsExecuteOnNeverStartedChildren
  • testGroupShutdownNonZeroQuietPeriodTerminatesUnusedWithoutThreads
  • full SingleThreadEventExecutorTest 20/20 green locally (Temurin 21).
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Aug 4, 2026

Copy link
Copy Markdown
Member

@arimu1 did you sign our icla yet ? https://netty.io/s/icla

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

normanmaurer
normanmaurer reviewed Aug 4, 2026
View reviewed changes
Comment thread common/src/main/java/io/netty/util/concurrent/MultithreadEventExecutorGroup.java Outdated
// Pass the caller's quietPeriod/timeout to every child, including never-started
// ones (#17135). SingleThreadEventExecutor terminates never-started children
// without creating a worker when the quiet period elapses with no tasks, and
// only starts a worker if execute() arrives during the quiet period.

@normanmaurer normanmaurer Aug 4, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imho all of this can be removed... and so there needs to be no changes at all to this class

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@arimu1

arimu1 commented Aug 4, 2026

Copy link
Copy Markdown
Author

Hi @normanmaurer — thanks for the nudge. ICLA signed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Aug 12, 2026

Copy link
Copy Markdown
Member

@arimu1 please check the test-failures

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

arimu1 added a commit to arimu1/netty that referenced this pull request Aug 12, 2026
@arimu1 @cursoragent
IoUringIoHandler: destroy never-initialized rings without io_uring_enter
32772f7
SingleThreadEventExecutor.tryTerminateIfNeverStarted() calls cleanup()
off-thread before run()/initialize(). IoUring rings are created disabled;
destroy()'s submission path needs enable() first, which caused
io_uring_enter error -77 in IoUringEventLoopTest.shutdownBeforeStart.

Skip submission-based teardown when initialize() never ran; release buffer
rings and close the ring directly instead.

Fixes CI failures reported on netty#17183.

Signed-off-by: arimu1 <[email protected]>
Co-authored-by: Cursor <[email protected]>
@arimu1

arimu1 commented Aug 12, 2026

Copy link
Copy Markdown
Author

@normanmaurer Checked the TestLens failures on run 31501037046 — all linux-x86_64 Java jobs failed for the same reason in netty-transport-native-io_uring:

Failing tests (2 errors, 0 assertion failures)

  • IoUringEventLoopTest.shutdownBeforeStart (from AbstractSingleThreadEventLoopTest)
  • IoUringEventLoopTest.shutdownGracefullyZeroQuietBeforeStart

Root cause
Our never-started shutdown path (SingleThreadEventExecutor.tryTerminateIfNeverStarted) correctly calls SingleThreadIoEventLoop.cleanup() → IoUringIoHandler.destroy() without ever starting the event-loop thread. That is the intended #17135 behaviour.

However, IoUringIoHandler.initialize() (which calls ringBuffer.enable()) only runs from run() on the loop thread. On a never-started loop, destroy() still tried to submit SQEs / call io_uring_enter, which fails on a disabled ring:

UncheckedIOException: io_uring_enter(..) failed with error(-77): File descriptor in bad state
  at IoUringIoHandler.destroy(...)
  at SingleThreadEventExecutor.tryTerminateIfNeverStarted(...)

This is specific to io_uring; epoll/kqueue/NIO paths do not have the enable-before-enter requirement and were unaffected.

Fix (32772f7)
Track whether initialize() ran; if destroy() is called on a never-started handler, skip submission-based teardown and close buffer rings + ring FD directly via completeRingClose().

Pushed to the branch — CI should re-run shortly. I cannot reproduce io_uring tests locally (macOS); the diagnosis is from the CI stack traces above.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arimu1

arimu1 commented Aug 12, 2026

Copy link
Copy Markdown
Author

Follow-up after internal review of the IoUring CI fix:

  • Rewrote tip commit to remove an accidental Cursor co-author trailer
  • Dropped the comment-only MultithreadEventExecutorGroup hunk (zero diff vs 4.2) per your earlier note
  • Removed unused SingleThreadEventExecutor.isNeverStarted()

IoUring never-initialized destroy() guard remains. Waiting on linux io_uring CI for shutdownBeforeStart / shutdownGracefullyZeroQuietBeforeStart.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

arimu1 added a commit to arimu1/netty that referenced this pull request Aug 12, 2026
@arimu1
IoUringIoHandler: destroy never-initialized rings without io_uring_enter
519cc47
SingleThreadEventExecutor.tryTerminateIfNeverStarted() calls cleanup()
off-thread before run()/initialize(). IoUring rings are created disabled;
destroy()'s submission path needs enable() first, which caused
io_uring_enter error -77 in IoUringEventLoopTest.shutdownBeforeStart.

Skip submission-based teardown when initialize() never ran; release buffer
rings and close the ring directly instead.

Fixes CI failures reported on netty#17183.

Signed-off-by: arimu1 <[email protected]>
@arimu1
arimu1 force-pushed the fix/17135-shutdown-unstarted-threads branch from 32772f7 to 2bb0c8a Compare August 12, 2026 23:55
@normanmaurer normanmaurer added this to the 4.2.18.Final milestone Aug 13, 2026
@yawkat yawkat mentioned this pull request Aug 15, 2026
Java CI does not terminate after Netty 4.2.17 upgrade micronaut-projects/micronaut-core#12887
Closed
@idsoke idsoke mentioned this pull request Aug 15, 2026
Pin Netty back to 4.2.16.Final to fix Java CI hang micronaut-projects/micronaut-core#12888
Closed
2 tasks
chrisvest
chrisvest requested changes Aug 19, 2026
View reviewed changes

@chrisvest chrisvest left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code introduces a problem where suspension and task submission can both race, and hit an unfortunate interleaving where the existing executor thread suspends, but the task submission moves the state to ST_STARTED without actually starting a thread.

I… tried creating a test for this, which seems to catch the scenario (and pass on base 4.2), but I don't love how it looks. Maybe it can be written in a different/simpler way.

    @Test
    @Timeout(value = 10, unit = TimeUnit.SECONDS)
    public void testExecuteRacingSuspensionDoesNotStrandExecutor() throws Exception {
        final AtomicBoolean armed = new AtomicBoolean();
        final AtomicInteger armedCanSuspendCalls = new AtomicInteger();
        final CountDownLatch executorThreadAtReengage = new CountDownLatch(1);
        final CountDownLatch externalDone = new CountDownLatch(1);

        final SingleThreadEventExecutor executor = new SingleThreadEventExecutor(
            null, new DefaultThreadFactory("suspend-race"), false, true,
            Integer.MAX_VALUE, RejectedExecutionHandlers.reject()) {
            @Override
            protected void run() {
                for (;;) {
                    if (confirmShutdown()) {
                        return;
                    }
                    Runnable task = takeTask();
                    if (task != null) {
                        task.run();
                    }
                    if (isSuspended()) {
                        // Suspension requested: return so the base class can suspend this thread.
                        // Note: run() intentionally does not call canSuspend() so that the only
                        // canSuspend(int) calls after arming are the base class' two checks.
                        return;
                    }
                }
            }

            @Override
            protected boolean canSuspend(int state) {
                if (armed.get() && armedCanSuspendCalls.incrementAndGet() == 2) {
                    // Second armed call is the re-engage check canSuspend(ST_SUSPENDED): at this
                    // point the executor thread has already CAS'd the state to ST_SUSPENDED but
                    // has not yet reset the start gate. Let an external execute() race in now.
                    executorThreadAtReengage.countDown();
                    boolean interrupted = false;
                    while (externalDone.getCount() > 0) {
                        try {
                            externalDone.await();
                        } catch (InterruptedException e) {
                            interrupted = true;
                        }
                    }
                    if (interrupted) {
                        Thread.currentThread().interrupt();
                    }
                }
                return super.canSuspend(state);
            }

            @Override
            protected void wakeup(boolean inEventLoop) {
                interruptThread();
            }
        };

        // Start the executor thread and make sure it is parked in takeTask().
        LatchTask started = new LatchTask();
        executor.execute(started);
        started.await();

        // Arm the interception, then request suspension, then wait for executor to hit suspension point.
        armed.set(true);
        assertTrue(executor.trySuspend());
        assertTrue(executorThreadAtReengage.await(5, TimeUnit.SECONDS));

        // Racy external submission: CASing state from ST_SUSPENDED to ST_STARTED.
        // Despite the race, this *should* punt the executor thread back to started *or* start a new executor
        // thread (which will wait for the existing one to completely finish its suspension).
        LatchTask raced = new LatchTask();
        executor.execute(raced);

        // Let the old executor thread finish suspending.
        externalDone.countDown();

        // The expected behavior is that the raced task must eventually run, and not leave the executor stuck
        // in ST_STARTED state with no actual thread started.
        assertTrue(raced.await(10, TimeUnit.SECONDS));

        executor.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).syncUninterruptibly();
    }

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java Outdated
}
}

private final Runnable neverStartedQuietPeriodTask = new Runnable() {

@chrisvest chrisvest Aug 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this declaration up with the other fields.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
arimu1 and others added 8 commits August 21, 2026 16:42
@arimu1
SingleThreadEventExecutor: skip thread start on unused shutdown
fb206da
When shutdownGracefully() runs on an executor that was never started and
has no pending work, terminate without creating a worker thread.

MultithreadEventExecutorGroup walks every child on shutdown; without this
path, constructing a group of N and shutting it down unused spun up all N
threads only to exit immediately (netty#17135).
@arimu1
chore: re-trigger CI after environmental OOM/KQueue failures
59c7f47
Local SingleThreadEventExecutorTest is 18/18 green (JDK 21).
@arimu1
SingleThreadEventExecutor: fix never-started shutdown for IoEventLoop
2aa4f08
CI failures (TestLens / KQueue / Nio) showed AssertionError in
SingleThreadIoEventLoop.cleanup() when tryTerminateIfNeverStarted called
cleanup() off the event-loop thread.

- Bind current thread for cleanup so constructor-created IoHandler is destroyed
- Only fast-path when quietPeriod == 0 (honor graceful quiet period otherwise)
- MultithreadEventExecutorGroup uses quietPeriod=0 for never-started children
  so default shutdownGracefully() no longer starts unused workers (netty#17135)
@arimu1
Document never-started group quiet-period tradeoff for netty#17135
a9a6d4a
Never-started MultithreadEventExecutorGroup children still force
quietPeriod=0 so unused workers are not started. Document that late
execute after group.shutdownGracefully(nonZero) is rejected on those
children, and add a regression test covering that contract.
@arimu1
SingleThreadEventExecutor: honor quiet period for never-started children
d0ed2ad
Never-started executors with a non-zero quiet period stay SHUTTING_DOWN
without starting a worker, schedule a GlobalEventExecutor timer to
terminate when quiet elapses with no work, and start a worker only if
execute() arrives during the quiet period. MultithreadEventExecutorGroup
no longer forces quietPeriod=0 on unused children.

Addresses mega12345mega's design feedback on netty#17183 / netty#17135.

Signed-off-by: arimu1 <[email protected]>
@arimu1
IoUringIoHandler: destroy never-initialized rings without io_uring_enter
8186b96
SingleThreadEventExecutor.tryTerminateIfNeverStarted() calls cleanup()
off-thread before run()/initialize(). IoUring rings are created disabled;
destroy()'s submission path needs enable() first, which caused
io_uring_enter error -77 in IoUringEventLoopTest.shutdownBeforeStart.

Skip submission-based teardown when initialize() never ran; release buffer
rings and close the ring directly instead.

Fixes CI failures reported on netty#17183.

Signed-off-by: arimu1 <[email protected]>
@arimu1
Address review: drop MultithreadEventExecutorGroup hunk; remove unuse…
4494123
…d isNeverStarted

Norman noted the group-level comment-only change was unnecessary. Zero-diff
that file vs 4.2 and delete the unused never-started helper.

Signed-off-by: arimu1 <[email protected]>
@arimu1
SingleThreadEventExecutor: fix execute/suspend race stranding tasks
3373ed5
When execute() CASes ST_SUSPENDED to ST_STARTED while the event-loop
thread is still winding down, re-engage that thread or wake it so tasks
are not left on a started executor with no worker. Includes regression
test from review and moves neverStartedQuietPeriodTask with other fields.
@arimu1
arimu1 force-pushed the fix/17135-shutdown-unstarted-threads branch from 4936f8c to 3373ed5 Compare August 21, 2026 09:45
@arimu1

arimu1 commented Aug 21, 2026

Copy link
Copy Markdown
Author

@chrisvest Thanks for catching the suspension race.

What went wrong: While the event-loop thread is winding down through canSuspend(ST_SUSPENDED), execute() can CAS ST_SUSPENDED → ST_STARTED and queue a task. issueDoStartThread() is a no-op because the old thread still holds threadStartIssued, and the re-engage path required a successful ST_SUSPENDED → ST_STARTED CAS — which fails once execute() already moved the state — so the thread exits and the executor sits in ST_STARTED with no worker.

Fix:

  1. In startThread(), after transitioning from ST_SUSPENDED, wake the still-live event-loop thread so it re-checks suspension.
  2. In the suspension exit path, re-engage whenever !canSuspend(ST_SUSPENDED) even if the state is already ST_STARTED (best-effort CAS only).
  3. Moved neverStartedQuietPeriodTask up with the other fields as suggested.

Included your regression test (testExecuteRacingSuspensionDoesNotStrandExecutor) — it times out on the prior tip and passes with the fix.

Local (Temurin 21): ./mvnw -pl common test -Dtest=SingleThreadEventExecutorTest → 19/19.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arimu1
SingleThreadEventExecutor: restart worker after suspend wind-down if …
c719d82
…work arrived

After canSuspend(ST_SUSPENDED) returns true, execute() may still CAS to
ST_STARTED while threadStartIssued is held during removeAll(). Recheck
state after clearing the start gate and issue a replacement worker when
needed. Adds regression test for that window and restores chrisvest's
test comments for the re-engage interleaving.
@arimu1

arimu1 commented Aug 21, 2026

Copy link
Copy Markdown
Author

Follow-up on @chrisvest's suspend/execute race review — the re-engage path inside the second canSuspend(ST_SUSPENDED) closes the parked-in-canSuspend interleaving, but there is a second window after that check returns true:

  1. Worker: canSuspend(ST_SUSPENDED) → true, suspend = true
  2. External: execute() CASes ST_SUSPENDED → ST_STARTED; issueDoStartThread() is a no-op while threadStartIssued is still held
  3. Worker: FastThreadLocal.removeAll(), clears thread = null / threadStartIssued, unlocks processingLock
  4. Without a follow-up start → ST_STARTED with a non-empty queue and no worker

Fix: after threadStartIssued.set(false) and processingLock.unlock() in doStartThread()'s suspend wind-down, recheck state and call issueDoStartThread() when state == ST_STARTED or ST_SHUTTING_DOWN <= state < ST_TERMINATED. Successful suspend stays ST_SUSPENDED; ST_TERMINATED is unchanged.

Tests:

  • Restored your comments on testExecuteRacingSuspensionDoesNotStrandExecutor (run() must not call canSuspend(); call 2 is the re-engage check).
  • Added testExecuteAfterSuspendDecisionDoesNotStrandExecutor: blocks after the second canSuspend returns true, so the race hits the threadStartIssued / removeAll() window.

Prove-it (Temurin 21): with the finally-recheck stashed, the new test times out at 10s; with it restored, ./mvnw -pl common test -Dtest=SingleThreadEventExecutorTest → 22/22.

Tip: c719d82eb4

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
Merge branch '4.2' into fix/17135-shutdown-unstarted-threads
5c5bf0f
@normanmaurer
normanmaurer requested a review from chrisvest August 27, 2026 06:28
@normanmaurer normanmaurer assigned franz1981 Aug 27, 2026
@normanmaurer

normanmaurer commented Aug 27, 2026

Copy link
Copy Markdown
Member

@franz1981 PTAL as well

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@franz1981

franz1981 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

@arimu1 I have some concern on this - but knowing what problem is trying to solve, will help me understand if the added complexity is worthy.

micronaut-projects/micronaut-core#12887 seems the only "prod-grade" issue which looks to dependent on this, but as @normanmaurer answered on that issue, "why it was working before"?
Which is how I currently feel about this change: creating and destroying event loop groups which are not used is not how Netty is commonly used nor is good to be used, as these are heavy objects - so I don't see the point to fix a misuse by making a complex state machine even more complex.
What is your use case for the additional complexity I see in this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest chrisvest modified the milestones: 4.2.18.Final, 4.2.19.Final Sep 10, 2026
@allthingssecurity allthingssecurity mentioned this pull request Sep 24, 2026
Don't strand tasks when trySuspend() races with startThread() #17608
Merged
normanmaurer added a commit that referenced this pull request Sep 28, 2026
@allthingssecurity @normanmaurer
Don't strand tasks when trySuspend() races with startThread() (#17608)
c4e7d1e
Motivation:

Since #15766, `trySuspend()` moves an executor that was never started
directly from `ST_NOT_STARTED` to `ST_SUSPENDED`. `startThread()` reads
the state once and then does a single CAS from that value to
`ST_STARTED`:

```java
int currentState = state;
if (currentState == ST_NOT_STARTED || currentState == ST_SUSPENDED) {
    if (STATE_UPDATER.compareAndSet(this, currentState, ST_STARTED)) {
```

If `trySuspend()` runs between the read and the CAS, the CAS fails and
`startThread()` returns without starting a thread. The task that
`execute()` just added then sits in the queue of an executor that
reports `isSuspended() == true` and has no thread. It only runs if
something else is submitted later.

`AutoScalingEventExecutorChooserFactory` can hit this: its monitor calls
`trySuspend()` on idle executors that were never started, while `next()`
may still hand the same executor out. A `Channel` registration on such
an event loop never completes, and because the loop is no longer in the
active set, nothing else is likely to wake it.

Modification:

Re-read the state and retry the CAS in `startThread()` while the state
is still `ST_NOT_STARTED` or `ST_SUSPENDED` (the `if` becomes a `while`,
plus a `break` after a successful start). The loop only retries when
another thread changed the state between the read and the CAS, so it
cannot spin: each extra round needs a new state change by someone else.
It can take more than two rounds, though. For example, the CAS loses to
`trySuspend()` (`ST_NOT_STARTED` to `ST_SUSPENDED`), then another
thread's `startThread()` wins, its `doStartThread()` fails and it resets
the state to `ST_NOT_STARTED`, and then this thread retries again. Any
state other than `ST_NOT_STARTED` or `ST_SUSPENDED` means another thread
started the executor, the old thread re-engaged, or the executor is
shutting down, and each of those already takes care of the queued task.

The retry may deliberately un-suspend an executor that `trySuspend()`
has just suspended. That is the same thing `execute()` already does for
an executor that is suspended, and the code comment at the retry says
so.

Add
`SingleThreadEventExecutorTest.testExecuteRacingTrySuspendWhenExecutorIsNotStarted`.
The race cannot be forced deterministically because there is no hook
between the state read and the CAS, so the test repeats `execute()`
against a concurrent `trySuspend()` on fresh executors 10000 times. The
executors use an `Executor` that only counts start requests, so no
threads are created and the check (exactly one start request per
`execute()`) is exact. It takes about 0.1s.

The test is regression-sensitive, not deterministic. Without the fix it
needs the two threads to actually run in parallel and hit the window
between the read and the CAS, so it may pass on machines with only 1 or
2 CPUs. With the fix it cannot fail falsely: every interleaving leads to
exactly one start request.

Result:

A task added by `execute()` always gets a thread, even if it races with
`trySuspend()`.

This regressed in #15766.

Testing:

- Without the fix the new test failed in every run on a 12-CPU machine,
typically within the first 20 to 140 iterations, for example:
`AssertionFailedError: iteration 69 (isSuspended=true) ==> expected: <1>
but was: <0>`
As said above, it may pass without the fix on machines with 1 or 2 CPUs.
- With the fix: `SingleThreadEventExecutorTest` 16 tests, 0 failures;
`common` module 1449 tests, 0 failures, 19 skipped; checkstyle passes.
- Standalone harnesses against the real classes: `execute()` racing
`trySuspend()` stranded the task in 5445 of 300000 iterations before the
fix and 0 of 300000 after. `SingleThreadIoEventLoop.register(channel)`
on NIO racing `trySuspend()` hung 39 of 4000 registrations before and 0
of 3000 after.

Interaction with open PRs:

- #17601 (port of #17589) changes the post-`run()` decision in
`doStartThread()`, a different code path (a running thread that is
suspending). The two merge cleanly, and `SingleThreadEventExecutorTest`
passes with both (17 tests). The model below was checked with both fixes
applied.
- #17183 and #15813 also edit `startThread()` and conflict textually,
since this change turns the `if` into a `while`. Their extra `else if`
branch moves after the loop as a plain `if` on the last observed state.
With that resolution the tests pass for this change with #17183 (23
tests) and with #15813 (`SingleThreadEventExecutorTest` and
`AutoScalingEventExecutorChooserFactoryTest`, 24 tests).

This was found with a TLA+ model of the executor state machine (liveness
property "an accepted task eventually runs" violated) and reproduced
with the real classes. With the retry, the model passes
`MutualExclusion`, `RunningHasThread` and `TaskRuns`/`TaskResolved`. It
was checked alone and together with the #17589 fix (where it also passes
`NoSpuriousShutdown`), with 2 submitters, up to 2 `trySuspend()` calls,
graceful shutdown and scheduled-task cancellation, starting from both
`ST_NOT_STARTED` and `ST_STARTED`, up to 1.44M distinct states.

Co-authored-by: Norman Maurer <[email protected]>
@netty-project-bot netty-project-bot mentioned this pull request Sep 28, 2026
Auto-port 5.0: Don't strand tasks when trySuspend() races with startThread() #17654
Merged
normanmaurer added a commit that referenced this pull request Sep 29, 2026
@netty-project-bot @allthingssecurity @normanmaurer
Auto-port 5.0: Don't strand tasks when trySuspend() races with startT…
ff9e407
…hread() (#17654)

Auto-port of #17608 to 5.0
Cherry-picked commit: c4e7d1e

---
Motivation:

Since #15766, `trySuspend()` moves an executor that was never started
directly from `ST_NOT_STARTED` to `ST_SUSPENDED`. `startThread()` reads
the state once and then does a single CAS from that value to
`ST_STARTED`:

```java
int currentState = state;
if (currentState == ST_NOT_STARTED || currentState == ST_SUSPENDED) {
    if (STATE_UPDATER.compareAndSet(this, currentState, ST_STARTED)) {
```

If `trySuspend()` runs between the read and the CAS, the CAS fails and
`startThread()` returns without starting a thread. The task that
`execute()` just added then sits in the queue of an executor that
reports `isSuspended() == true` and has no thread. It only runs if
something else is submitted later.

`AutoScalingEventExecutorChooserFactory` can hit this: its monitor calls
`trySuspend()` on idle executors that were never started, while `next()`
may still hand the same executor out. A `Channel` registration on such
an event loop never completes, and because the loop is no longer in the
active set, nothing else is likely to wake it.

Modification:

Re-read the state and retry the CAS in `startThread()` while the state
is still `ST_NOT_STARTED` or `ST_SUSPENDED` (the `if` becomes a `while`,
plus a `break` after a successful start). The loop only retries when
another thread changed the state between the read and the CAS, so it
cannot spin: each extra round needs a new state change by someone else.
It can take more than two rounds, though. For example, the CAS loses to
`trySuspend()` (`ST_NOT_STARTED` to `ST_SUSPENDED`), then another
thread's `startThread()` wins, its `doStartThread()` fails and it resets
the state to `ST_NOT_STARTED`, and then this thread retries again. Any
state other than `ST_NOT_STARTED` or `ST_SUSPENDED` means another thread
started the executor, the old thread re-engaged, or the executor is
shutting down, and each of those already takes care of the queued task.

The retry may deliberately un-suspend an executor that `trySuspend()`
has just suspended. That is the same thing `execute()` already does for
an executor that is suspended, and the code comment at the retry says
so.

Add
`SingleThreadEventExecutorTest.testExecuteRacingTrySuspendWhenExecutorIsNotStarted`.
The race cannot be forced deterministically because there is no hook
between the state read and the CAS, so the test repeats `execute()`
against a concurrent `trySuspend()` on fresh executors 10000 times. The
executors use an `Executor` that only counts start requests, so no
threads are created and the check (exactly one start request per
`execute()`) is exact. It takes about 0.1s.

The test is regression-sensitive, not deterministic. Without the fix it
needs the two threads to actually run in parallel and hit the window
between the read and the CAS, so it may pass on machines with only 1 or
2 CPUs. With the fix it cannot fail falsely: every interleaving leads to
exactly one start request.

Result:

A task added by `execute()` always gets a thread, even if it races with
`trySuspend()`.

This regressed in #15766.

Testing:

- Without the fix the new test failed in every run on a 12-CPU machine,
typically within the first 20 to 140 iterations, for example:
`AssertionFailedError: iteration 69 (isSuspended=true) ==> expected: <1>
but was: <0>`
As said above, it may pass without the fix on machines with 1 or 2 CPUs.
- With the fix: `SingleThreadEventExecutorTest` 16 tests, 0 failures;
`common` module 1449 tests, 0 failures, 19 skipped; checkstyle passes.
- Standalone harnesses against the real classes: `execute()` racing
`trySuspend()` stranded the task in 5445 of 300000 iterations before the
fix and 0 of 300000 after. `SingleThreadIoEventLoop.register(channel)`
on NIO racing `trySuspend()` hung 39 of 4000 registrations before and 0
of 3000 after.

Interaction with open PRs:

- #17601 (port of #17589) changes the post-`run()` decision in
`doStartThread()`, a different code path (a running thread that is
suspending). The two merge cleanly, and `SingleThreadEventExecutorTest`
passes with both (17 tests). The model below was checked with both fixes
applied.
- #17183 and #15813 also edit `startThread()` and conflict textually,
since this change turns the `if` into a `while`. Their extra `else if`
branch moves after the loop as a plain `if` on the last observed state.
With that resolution the tests pass for this change with #17183 (23
tests) and with #15813 (`SingleThreadEventExecutorTest` and
`AutoScalingEventExecutorChooserFactoryTest`, 24 tests).

This was found with a TLA+ model of the executor state machine (liveness
property "an accepted task eventually runs" violated) and reproduced
with the real classes. With the retry, the model passes
`MutualExclusion`, `RunningHasThread` and `TaskRuns`/`TaskResolved`. It
was checked alone and together with the #17589 fix (where it also passes
`NoSpuriousShutdown`), with 2 submitters, up to 2 `trySuspend()` calls,
graceful shutdown and scheduled-task cancellation, starting from both
`ST_NOT_STARTED` and `ST_STARTED`, up to 1.44M distinct states.

Co-authored-by: allthingssecurity <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
allthingssecurity
allthingssecurity reviewed Sep 29, 2026
View reviewed changes

@allthingssecurity allthingssecurity left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the executor tests and a race harness against this PR: head 5c5bf0f585, and the same head merged locally with
current 4.2.

A task accepted by execute() is dropped, and a worker starts after termination.

tryTerminateIfNeverStarted() checks the queue one last time (SingleThreadEventExecutor.java:1321-1324) and then
moves ST_SHUTTING_DOWN to ST_TERMINATED (:1325). A concurrent execute() can run entirely between those two
steps:

  1. addTask(task).
  2. startThread() sees ST_SHUTTING_DOWN && thread == null (:1186) and calls issueDoStartThread(). The new worker
    blocks on processingLock (:1360), which the terminating thread holds.
  3. isShutdown() is still false, because the state is ST_SHUTTING_DOWN and not yet ST_SHUTDOWN. So execute()
    neither removes nor rejects the task and returns normally.

The terminating thread then does the CAS, runs cleanup(), and drainTasks() (:1341) throws the task away with
"An event executor terminated with non-empty task queue (1)". The caller's task is neither run nor rejected.

Once the lock is released, the worker takes it and enters run() on the terminated executor, after cleanup():

  • With a DefaultEventExecutor-style run(), it parks in takeTask() forever, because the wakeup task was drained as
    well. The thread leaks. My stress JVM with non-daemon threads did not exit after main returned, and the thread dump
    showed the worker in takeTask().
  • If that worker is interrupted, it goes through termination a second time: cleanup() runs again and
    terminationFuture.setSuccess throws IllegalStateException: complete already.
  • For a SingleThreadIoEventLoop (from reading the code), the late worker would call ioHandler.initialize() after
    destroy(), then destroy() a second time from cleanup().

The comment at :1297 says taking processingLock avoids racing with a just-started worker. That only covers a
worker started before the tryLock(). A worker issued while this method runs just waits for the lock.

Deterministic reproducer (run on this PR merged with 4.2, so the line number in the trace comes from that merge). A
newTaskQueue() override pauses the shutting-down thread inside the second
isEmpty() call made from tryTerminateIfNeverStarted(), and another thread calls execute() meanwhile:

hook fired (window between last empty check and CAS to TERMINATED): true
execute() returned normally: true, task ran: false, rejected: false
terminationFuture done: true, isTerminated: true, cleanup() calls: 1
worker thread started: true, run() entered after cleanup(): true, still alive 500ms after termination: true (WAITING)
Exception in thread "det-1-1" java.lang.IllegalStateException: complete already: DefaultPromise@...(success)
    at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1486)
after interrupting the worker: alive=false, cleanup() calls: 2

On 4.2 this window does not exist: the executor is shut down by its own worker, and the late execute() is rejected.

Without hooks. Each iteration runs shutdownGracefully(0, 0, SECONDS) against execute() on a fresh, never-started
executor, with the two threads released by a barrier plus a random spin, and 4 busy-loop CPU hogs running:

Build Iterations Tasks lost (not run, not rejected) Workers in run() after cleanup()
PR head 43,000 (3k + 10k + 30k) 6 1 (that one never exited)
PR merged with 4.2 30,000 3 0
4.2 73,000 0 0

Possible direction. The never-started termination and the ST_SHUTTING_DOWN start in startThread() need to
exclude each other. One way:

  • claim threadStartIssued in tryTerminateIfNeverStarted() before the final emptiness check, so no worker can be
    issued after that check;
  • move to ST_SHUTDOWN before the check, as the worker path does at :1430-1441. A concurrent execute() then either
    has its task seen by the check (start a worker, as now), or its own isShutdown() check rejects the task.

Merge conflict with #17608. #17608 (merged yesterday) turned the if in startThread() into a while that
re-reads the state after a lost CAS, and this PR now conflicts with 4.2 there. I resolved it locally like this:

  • keep the loop;
  • move the ST_SHUTTING_DOWN && thread == null branch into a separate if after it. After a successful start the loop
    breaks with currentState still NOT_STARTED or SUSPENDED, so that branch is skipped.

With that resolution these all pass:

  • SingleThreadEventExecutorTest, 24 tests, including this PR's tests and #17608's
    testExecuteRacingTrySuspendWhenExecutorIsNotStarted;
  • GlobalEventExecutorTest, 6 tests.

The race above is unchanged after the merge (3 lost in 30,000).

Claude Code on behalf of allthingssecurity

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
if (!taskQueue.isEmpty() || nextScheduledTaskDeadlineNanos() != -1 || !shutdownHooks.isEmpty()) {
return false;
}
if (STATE_UPDATER.compareAndSet(this, currentState, ST_TERMINATED)) {

@allthingssecurity allthingssecurity Sep 29, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An execute() that runs between the check above and this CAS gets lost. addTask succeeds. startThread() takes
the ST_SHUTTING_DOWN && thread == null branch and issues a worker, which blocks on processingLock.
isShutdown() is still false, so the task is not rejected. After the CAS, drainTasks() below discards it, and the
blocked worker then enters run() on the terminated executor. Deterministic reproducer and numbers are in the
review body.

Claude Code on behalf of allthingssecurity

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java Outdated
}
}
}
} else if (currentState == ST_SHUTTING_DOWN && thread == null) {

@allthingssecurity allthingssecurity Sep 29, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch can issue a worker after tryTerminateIfNeverStarted() did its last queue check. That worker then runs
after cleanup(): it parks in takeTask() forever, or runs cleanup() a second time if interrupted. It needs to be
mutually exclusive with the inline termination, for example through threadStartIssued.

Claude Code on behalf of allthingssecurity

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
* a thread; {@code false} if a thread still needs to be started to drain work / run shutdown.
*/
private boolean tryTerminateIfNeverStarted() {
// Try to take the processing lock so we do not race with a just-started worker thread.

@allthingssecurity allthingssecurity Sep 29, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lock only protects against a worker that already holds it. A worker issued while this method runs waits on
processingLock.lock() (:1360), and it runs right after we release the lock, with the state already
ST_TERMINATED.

Claude Code on behalf of allthingssecurity

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
arimu1 added 2 commits October 3, 2026 12:32
@arimu1
Merge branch '4.2' into fix/17135-shutdown-unstarted-threads
68879cd
Keep the netty#17608 startThread retry loop, and run the never-started
SHUTTING_DOWN worker start only after that loop.
@arimu1
SingleThreadEventExecutor: reject tasks that race never-started termi…
fae4cca
…nation

tryTerminateIfNeverStarted() checked the queue and then jumped to
TERMINATED while the executor was still SHUTTING_DOWN, so a concurrent
execute() could enqueue a task and start a worker that ran after
cleanup(). Publish SHUTDOWN before the last emptiness check and hold
the start gate so the task is rejected or a worker drains it.

Signed-off-by: arimu1 <[email protected]>
@arimu1

arimu1 commented Oct 3, 2026

Copy link
Copy Markdown
Author

Addressed the race in fae4cca, and merged current 4.2. The startThread retry loop from #17608 stays; the never-started SHUTTING_DOWN start runs after that loop.

tryTerminateIfNeverStarted() now claims threadStartIssued and publishes ST_SHUTDOWN before the last emptiness check. An execute() in that window is rejected. Work that was queued before ST_SHUTDOWN starts a worker instead of being dropped by drainTasks(). SingleThreadEventExecutorTest passed locally on JDK 21, including testExecuteDuringNeverStartedTerminationIsNotDropped.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer modified the milestones: 4.2.19.Final, 4.2.20.Final Oct 14, 2026
@chrisvest
Merge branch '4.2' into fix/17135-shutdown-unstarted-threads
378d158
@testlens-app

testlens-app Bot commented Oct 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🚨 TestLens detected 2 failed tests 🚨

Test Summary

Tip

Inspect all details with the TestLens CLI: testlens pr 17183

Build PR / linux-x86_64-java11-boringssl build > Netty/Handler/Ssl/Ocsp

Test Runs Flakiness
OcspServerCertificateValidatorTest > connectUsingHttpAndValidateCertificateUsingOcspTest() 🚫 ❌ 1% 🟡

Build PR / macos-aarch64-java11-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendDirectByteBuf(TestInfo) 🚫 ❌ 3% 🟡

🏷️ Commit: 378d158
▶️ Tests: 50473 executed
⚪️ Checks: 26/26 completed

Test Failures

OcspServerCertificateValidatorTest > connectUsingHttpAndValidateCertificateUsingOcspTest() (Netty/Handler/Ssl/Ocsp in Build PR / linux-x86_64-java11-boringssl build)
org.opentest4j.AssertionFailedError: expected: <VALID> but was: <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1145)
	at io.netty.handler.ssl.ocsp.OcspServerCertificateValidatorTest.connectUsingHttpAndValidateCertificateUsingOcspTest(OcspServerCertificateValidatorTest.java:160)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
expected actual
VALID null
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendDirectByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java11-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend0(DatagramUnicastTest.java:368)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend(DatagramUnicastTest.java:194)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendDirectByteBuf(DatagramUnicastTest.java:90)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$1.run(DatagramUnicastTest.java:84)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$1.run(DatagramUnicastTest.java:81)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendDirectByteBuf(DatagramUnicastTest.java:81)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)

Rerun Controls

Select tests to mute in this pull request:

  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendDirectByteBuf(TestInfo)
  • OcspServerCertificateValidatorTest > connectUsingHttpAndValidateCertificateUsingOcspTest()

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest

chrisvest commented Oct 19, 2026

Copy link
Copy Markdown
Member

These changes are looking increasingly complicated and fragile, so I'm starting to think that either the approach is wrong, or the juice might not be worth the squeeze.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Oct 20, 2026

Copy link
Copy Markdown
Member

I agree with @chrisvest here

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest

chrisvest commented Oct 26, 2026

Copy link
Copy Markdown
Member

Closing this

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest chrisvest closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@normanmaurer normanmaurer normanmaurer left review comments
@chrisvest chrisvest Awaiting requested review from chrisvest
+1 more reviewer
@allthingssecurity allthingssecurity allthingssecurity left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@franz1981 franz1981

Labels

None yet

Projects

None yet

Milestone

4.2.20.Final

Development

Successfully merging this pull request may close these issues.

Shutting down MultiThreadIoEventLoopGroup starts all unstarted threads

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@arimu1 @normanmaurer @mega12345mega @franz1981 @chrisvest @allthingssecurity
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.