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 — Let the IoHandler process cancelled registrations before the event loop suspends by allthingssecurity · Pull Request #17743 · netty/netty

Conversation

@allthingssecurity

@allthingssecurity allthingssecurity commented Oct 2, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Let the IoHandler process cancelled registrations before the event loop suspends

Motivation:

A SingleThreadIoEventLoop that was asked to suspend (trySuspend(), called by the AutoScalingEventExecutorChooserFactory or by the user) keeps running while it has registrations, and suspends as soon as it has no tasks and no registrations left. When the last channel on such a loop is closed, doDeregister() cancels the registration in the same runAllTasks(...) call, and the loop suspends right after it, without running the IoHandler again.

For NIO this means the channel is not really closed. The JDK only closes the file descriptor of a channel that is still registered with a Selector once that Selector flushes the cancelled key, and that happens in the next select operation. So, after serverChannel.close().sync():

  • the socket keeps listening, and clients can still connect (into the backlog) and then hang,
  • binding the same port fails with BindException,
  • closed client channels keep their file descriptor,

until the loop is resumed by new work, which may never happen once the auto-scaler stopped using it.

A loop can be in this state while it still has channels, because trySuspend() only takes effect once the last registration is gone. For example, the auto-scaler picks a loop that had no channels, and a channel is registered on it before trySuspend() runs. The same can happen if the auto-scaler calls trySuspend() between the deregistration and the end of the loop iteration.

kqueue is not affected in the same way (closing the fd removes its events), but its cancelled registrations are also only processed on the next run.

io_uring needs more than one run (reported by @dreamlike-ocean): DefaultIoUringIoRegistration.cancel() returns true at once, but while operations of the registration are outstanding it only marks the registration for removal. It is removed, and IoHandle.unregistered() is called, only once the last completion arrived, which can be several runs later. So the loop can suspend with completions still outstanding, and these are not processed (and the resources of the registration not released) until the loop is resumed.

Modification:

  • SingleThreadIoEventLoop counts the registrations that were cancelled since the IoHandler last ran, and canSuspend(...) returns false while this count is not zero. The count is a plain int that only the event loop accesses; a cancellation from another thread submits the increment as a task before the registration count drops.
  • While the loop is suspending and there are such cancellations, IoHandlerContext.canBlock() returns false, so the IoHandler does one non-blocking run (for NIO a selectNow()) before the loop suspends. Loops that are not suspending behave as before.
  • Add IoHandler.hasPendingCancellations(), a default method that returns false, for an IoHandler that needs more than one run to finish with a cancelled registration. canSuspend(...) also returns false while it returns true. canBlock() does not check it: the handler waits for IO in this case, and that IO wakes up a blocking run, so not blocking would only make the loop spin.
  • IoUringIoHandler counts the registrations that wait for completions before they can be removed, and returns true from hasPendingCancellations() while there are any. The count is reset once the ring is closed.
  • Add NioEventLoopTest.testChannelClosedBeforeSuspendIsReallyClosed. It binds a NioServerSocketChannel, calls trySuspend(), closes the channel, waits until the loop thread exits and checks that connecting to the address fails.
  • Add IoUringEventLoopTest.testCancelledRegistrationWithOutstandingCompletionBeforeSuspend. It registers an IoUringIoHandle, submits a poll on an eventfd (which only completes once the test writes to the eventfd), calls trySuspend() and cancels the registration. The loop must not suspend until the eventfd is written, the poll completed and the handle was unregistered.

Result:

A channel closed right before its event loop suspends is really closed, and an io_uring loop only suspends once its cancelled registrations were really removed.

  • Without the change to SingleThreadIoEventLoop, the NIO test fails (the connect succeeds). With it, the test passes, and so do the io.netty.channel tests of transport (410 tests, 10 skipped) and io.netty.testsuite.transport.NioEventLoopTest / DefaultEventLoopTest in testsuite (25 tests, 3 skipped).
  • Without the io_uring part, the io_uring test fails (the loop thread exits while the poll is outstanding). With it, the test passes, and so do IoUringEventLoopTest, IoUringCustomIoHandleTest, IoUringIoHandler*Test and a set of io_uring socket tests (172 tests, 5 skipped), run on Linux 6.10 (aarch64) with the native library built from this branch.
  • The tests pass with paranoid leak detection, without any LEAK: report. Checkstyle and the API check pass.

Prepared with Claude Code on behalf of allthingssecurity.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

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

franz1981 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@allthingssecurity @claude
Let the IoHandler process cancelled registrations before the event lo…
70798b5
…op suspends

Motivation:

`SingleThreadIoEventLoop` suspends as soon as it is asked to (`trySuspend()`, for example by the `AutoScalingEventExecutorChooserFactory`), has no tasks and no registrations left. A channel that is closed on such a loop cancels its registration in the same `runAllTasks(...)` call, and the loop then suspends without running the `IoHandler` again.

For NIO this means the channel is never really closed: the JDK only closes the file descriptor of a channel that is still registered with a `Selector` once that `Selector` flushes the cancelled key, which happens in the next select operation. After `serverChannel.close().sync()` the socket keeps listening and accepts connections (into the backlog) until the loop is resumed by new work, which may never happen. Closed client channels keep their file descriptor the same way. A loop can be in this state while it still has channels, because `trySuspend()` only takes effect once the last registration is gone.

Modification:

- Count the registrations that were cancelled since the `IoHandler` last ran, and don't suspend while this count is not zero.
- When the loop is suspending and there are such cancellations, `IoHandlerContext.canBlock()` returns `false`, so the `IoHandler` does one non-blocking run (for NIO a `selectNow()`) before the loop suspends.
- Add `NioEventLoopTest.testChannelClosedBeforeSuspendIsReallyClosed`.

Result:

A channel closed right before its event loop suspends is closed for real.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@normanmaurer normanmaurer mentioned this pull request Oct 4, 2026
Close I/O registrations when shutdown starts during queued tasks #17749
Open
@normanmaurer normanmaurer added this to the 4.2.20.Final milestone Oct 14, 2026
@normanmaurer normanmaurer added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Oct 14, 2026
@normanmaurer

normanmaurer commented Oct 14, 2026

Copy link
Copy Markdown
Member

@dreamlike-ocean @yawkat WDYT ?

All reactions

Sorry, something went wrong.

Uh oh!

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

franz1981
franz1981 requested changes Oct 14, 2026
View reviewed changes
Comment thread transport/src/main/java/io/netty/channel/SingleThreadIoEventLoop.java Outdated
// The number of registrations that were cancelled since the IoHandler did run the last time. We must not suspend
// before the IoHandler did process these, as for example NIO only closes the file descriptor of a channel that was
// closed while still registered during the next select operation.
private final AtomicInteger cancelledRegistrations = new AtomicInteger();

@franz1981 franz1981 Oct 14, 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.

why not an atomic boolean?
I suppose cancel can happen from any thread, correct?

Sorry, something went wrong.

Uh oh!

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

All reactions

@allthingssecurity allthingssecurity Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

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.

Good point, a boolean is enough: the loop only needs to know whether a registration was cancelled since the IoHandler last ran, not how many. Changed in 6603f02.

The flag is cleared before ioHandler.run(...), not after it. The run then processes every cancellation that happened until then, and a cancellation that happens during the run sets the flag again, so the next run picks it up and the loop does not suspend in between. Clearing it after the run could lose a cancellation that came in while the handler was running.

On threads: cancel() normally runs on the loop (doDeregister()), but the IoRegistration contract does not restrict the caller, and the NIO registration guards its own cancel() with a compareAndSet. So I kept the flag atomic rather than a plain field.

Re-ran the transport event-loop tests (NioEventLoopTest including the new test, SingleThreadIoEventLoopTest, ManualIoEventLoopTest, LocalChannelTest, AutoScalingEventExecutorChooserFactoryTest) with checkstyle and paranoid leak detection: all pass, no leaks.

Claude Code on behalf of allthingssecurity

Sorry, something went wrong.

Uh oh!

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

franz1981 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@franz1981 franz1981 Oct 14, 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.

@normanmaurer so for close is not guaranteed it runs on the event loop?

Sorry, something went wrong.

Uh oh!

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

All reactions

@franz1981 franz1981 Oct 14, 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.

and @allthingssecurity the reason is to avoid another atomic read in the loop, as the num regs is atomic for a different reason. Check how the DefaultNioRegistration.cancel() is thread confined

Sorry, something went wrong.

Uh oh!

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

All reactions

@allthingssecurity allthingssecurity Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

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.

Thanks, that makes sense. Changed in 983496b: the count is now a plain int that only the event loop reads and writes, so the loop does no extra atomic read.

  • cancel() on the event loop (the normal case, doDeregister(), and the only case for NIO, as you said) increments it directly.
  • cancel() from another thread is supported by the epoll, kqueue, io_uring and local registrations, so the wrapper submits the increment as a task in that case. The task is submitted before numRegistrations drops, so the loop can't suspend before it ran.

This also fixes a mistake in my previous commit, which is your timing question: it cleared the flag before ioHandler.run(...), so canBlock() could return true during that run and NIO could do a blocking select() while the loop was about to suspend. Now runIo() keeps the count during the run, so canBlock() stays false and that run is a selectNow(). After the run it subtracts only what it saw before, so a cancellation during the run (for example a channel closed from a read handler) is kept for one more run.

On spinning: canBlock() is only false because of this while the loop is suspending and a cancellation is pending, and every run clears what it saw. So each cancellation costs at most one extra selectNow(), and the loop then suspends; it can only keep going if channels keep being cancelled, and then it is not idle.

Re-ran the transport event-loop tests with checkstyle and paranoid leak detection: all pass, no leaks. I could not run the epoll/io_uring tests here (macOS).

Claude Code on behalf of allthingssecurity

Sorry, something went wrong.

Uh oh!

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

All reactions
@franz1981

franz1981 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Another qq @allthingssecurity this seems to commit on the existing NIO impl in OpenJDK - but what happens if that change become less lazy. as it was in the past? I'm asking because on Loom the existing behaviour is not optimal and I plan to send a patch for that...

All reactions

Sorry, something went wrong.

Uh oh!

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

@allthingssecurity @claude
Track a pending cancellation with an AtomicBoolean instead of a counter
6603f02
Motivation:

Review asked why the cancelled registrations are counted. The event loop only
needs to know whether a cancellation happened since the IoHandler last ran.

Modifications:

Replace the counter with an AtomicBoolean that cancel() sets and runIo() clears
before running the IoHandler, so a cancellation during the run (for example
from another thread) is kept for the next run.

Result:

Simpler state, same behaviour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allthingssecurity

allthingssecurity commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@franz1981 the change does not rely on the JDK closing lazily, it only makes sure the IoHandler runs once more after a cancellation before the loop suspends. The lazy close in the current SelectorImpl is why that run matters for NIO today, but the event loop itself makes no assumption about what the handler does in it.

If the JDK closes eagerly again (or with your Loom patch):

  • the fd is already closed when cancel() returns, so the new test still passes, as it only checks that the port no longer accepts connections;
  • the extra run is a selectNow(), not a blocking select: canBlock() returns false while the loop is suspended and a cancellation is pending, so the cost is one non-blocking select before the loop suspends, and only on a loop that is asked to suspend.

So with an eager JDK the change becomes a cheap no-op instead of a fix, and it stays correct for any IoHandler that does part of the work for a cancelled registration in its next run.

Claude Code on behalf of allthingssecurity

All reactions

Sorry, something went wrong.

Uh oh!

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

@franz1981

franz1981 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

@allthingssecurity

thanks

the extra run is a selectNow()

exactly my guess. I would make sure if there're no unlucky timing which can cause spinning on selectNow instead of suspending

All reactions

Sorry, something went wrong.

Uh oh!

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

@allthingssecurity @claude
Count cancellations in a field that only the event loop accesses
983496b
Motivation:

Review asked to avoid another atomic read in the event loop. Also, the previous
commit cleared the pending flag before running the IoHandler, so canBlock()
could return true during that run and NIO could do a blocking select instead
of a selectNow() while the loop was about to suspend.

Modifications:

Use a plain int that only the event loop reads and writes. A cancellation on
the event loop increments it directly; one from another thread submits the
increment as a task before the registration count drops, so the loop can't
suspend before it ran. runIo() keeps the count during the run (so canBlock()
stays false) and only subtracts what it saw before the run, so cancellations
during the run are kept for the next run.

Result:

No extra atomic read in the loop, and the run that processes the cancellation
never blocks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dreamlike-ocean

dreamlike-ocean commented Oct 14, 2026

Copy link
Copy Markdown
Member

I found a race between registration cancellation and event loop suspension in the io_uring transport.

When IoRegistration.cancel() returns true, SingleThreadIoEventLoop immediately decrements numRegistrations. However, IoUringIoHandler may keep the registration in its registrations map until all outstanding CQEs have been processed.

This means the event loop can see numRegistrations == 0 and suspend while the handler still has pending completions. Those CQEs remain unprocessed, and the associated resources remain unreleased until the loop resumes.

All reactions

Sorry, something went wrong.

Uh oh!

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

@allthingssecurity

allthingssecurity commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@dreamlike-ocean thanks, I checked it and agree. In IoUringIoHandler, DefaultIoUringIoRegistration.cancel() returns true at once, but tryRemove() only sets removeLater while outstandingCompletions > 0. The mapping is removed and handle.unregistered() is called only when the last CQE without IORING_CQE_F_MORE comes in. So numRegistrations can be 0 while the ring still has completions for that registration.

This PR does not close that case. It guarantees one more IoHandler.run(...) after a cancellation before the loop suspends. That is enough for NIO, where the deferred work is the deregistration in the next select, and for io_uring when no completions are outstanding. With outstanding completions, io_uring may need several runs, and only the handler knows when it is done. The numRegistrations decrement in cancel() is older than this PR, so this also happens on 4.2 today.

A fix that covers both would be to let the handler say whether it still has work for cancelled registrations, and check that in canSuspend() and canBlock(). For example, a default method on IoHandler that returns false, which IoUringIoHandler overrides to report registrations waiting for completions. With that, the counter in this PR could become NIO's answer to the same question. That adds API to IoHandler, though, so I'd like @normanmaurer's view first: should it go in this PR, or in a follow-up with its own io_uring test, with this PR staying the NIO fix?

Claude Code on behalf of allthingssecurity

All reactions

Sorry, something went wrong.

Uh oh!

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

@franz1981

franz1981 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

My 2c @allthingssecurity is "Let the IoHandler process cancelled registrations before the event loop suspends" don't seems to be tied to NIO, so it's supposed to work fine across all impl or better - harmless at least. But if you need a follow up fixing the same thing on uring it is better be here if possible 🙏

allthingssecurity reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@allthingssecurity

allthingssecurity commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Fair enough, I will do the io_uring part in this PR too: the handler reports registrations that are cancelled but still wait for completions, and the loop does not suspend while there are any. I will push it with a test that runs on io_uring (Linux).

Claude Code on behalf of allthingssecurity

franz1981 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@allthingssecurity @claude
Don't suspend while io_uring waits for completions of cancelled regis…
c74e15f
…trations

Motivation:

IoUringIoHandler only removes a cancelled registration (and calls
IoHandle.unregistered()) once the last completion of the operations that were
submitted before the cancellation arrived. This can take more than one run, but
SingleThreadIoEventLoop only waited for one more run after a cancellation, so
the loop could suspend while completions were still outstanding. These were then
not processed, and the resources of the registration not released, until the
loop was resumed.

Modifications:

- Add IoHandler.hasPendingCancellations(), which returns false by default.
  SingleThreadIoEventLoop.canSuspend(...) returns false while it returns true.
- IoUringIoHandler counts the registrations that wait for completions before
  they can be removed, and returns true while there are any. The count is reset
  once the ring is closed.
- canBlock() does not check hasPendingCancellations(): the outstanding
  completions wake up a blocking run, so not blocking would only make the loop
  spin.
- Add IoUringEventLoopTest.testCancelledRegistrationWithOutstandingCompletionBeforeSuspend.

Result:

A suspending io_uring event loop only suspends once its cancelled registrations
were really removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allthingssecurity

allthingssecurity commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Pushed the io_uring part in c74e15f.

  • IoHandler.hasPendingCancellations(): a new default method that returns false. An IoHandler returns true while it still has work to do for registrations that were cancelled, and SingleThreadIoEventLoop.canSuspend(...) returns false while it does. The default is false because NIO, epoll, kqueue and local are done with a cancelled registration after at most one more run, which the existing count in SingleThreadIoEventLoop already covers. epoll and local remove the registration in cancel(), and kqueue does it at the end of the next run.
  • io_uring: IoUringIoHandler counts the registrations that tryRemove() defers because completions are outstanding. The count goes up when removeLater is set and down when the last completion removes the registration. It only changes on the event loop, and it is reset when the ring is closed, so it can't stay above 0 after shutdown. hasPendingCancellations() returns count != 0.
  • canBlock(): it does not check the new method. In this case the handler is waiting for completions, and those wake up io_uring_enter. So a blocking run is correct here, and not blocking would make the loop spin until the completions arrive. The selectNow() case from before is unchanged: it costs one non-blocking run per cancellation, and only while suspending.
  • Test: IoUringEventLoopTest.testCancelledRegistrationWithOutstandingCompletionBeforeSuspend registers an IoUringIoHandle and submits a poll on an eventfd, which only completes once the test writes to it. It then calls trySuspend() and cancels the registration on the loop. The loop must not suspend before the eventfd is written; after the write, the handle must be unregistered before the loop thread exits.
    • I ran it on Linux 6.10 (aarch64, Docker with io_uring allowed), with the native library built from this branch and paranoid leak detection.
    • Without the main-code changes of this commit, it fails: the loop thread exits while the poll is outstanding. With them, it passes, and so do IoUringEventLoopTest, IoUringCustomIoHandleTest, IoUringIoHandler*Test, IoUringSocket{Echo,HalfClosed,Rst,Channel,ChannelEOF,ShutdownOutputBySelf,Connect}Test, IoUringBufferRingSocketEchoTest and IoUringDomainSocketEchoTest (172 tests, 5 skipped, no LEAK:).
    • The "must not suspend yet" check waits 500 ms. With the fix it can't fail spuriously, because the loop really is blocked until the write. Without the fix, a very slow machine could make it pass.
  • Also re-run on macOS with paranoid leak detection: the transport event-loop tests (NioEventLoopTest, SingleThreadIoEventLoopTest, ManualIoEventLoopTest, IoEventLoopGroupTest, MultiThreadIoEventLoopGroupTest, LocalChannelTest, AutoScalingEventExecutorChooserFactoryTest; 72 tests, 1 skipped). Checkstyle and revapi pass for transport, transport-classes-io_uring and transport-native-io_uring; revapi accepts the new default method without an exclusion.
  • Not run: the full io_uring testsuite, and the epoll and kqueue tests. ManualIoEventLoop has no suspension, so it needs no change.

Claude Code on behalf of allthingssecurity

All reactions

Sorry, something went wrong.

Uh oh!

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

@allthingssecurity @claude
Remove a cancelled io_uring registration even if its handle throws
27a52d3
Motivation:

DefaultIoUringIoRegistration.handle(...) only counted a completion, and removed
a cancelled registration once its last completion arrived, after
IoUringIoHandle.handle(...) returned. If the handle threw, this was skipped, so
the registration was never removed and its handle never got unregistered().
As hasPendingCancellations() now returns true while such a removal is pending,
the event loop could also never suspend anymore.

Modifications:

- Count the completion and do the deferred removal in a finally block. The
  exception still propagates to the completion loop, which logs it as before.
- Add IoUringEventLoopTest.testCancelledRegistrationWithThrowingCompletionBeforeSuspend.

Result:

A throwing IoUringIoHandle does not prevent the removal of its cancelled
registration nor the suspension of the event loop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allthingssecurity

allthingssecurity commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Small follow-up in 27a52d3: DefaultIoUringIoRegistration.handle(...) only counted the completion (and did the deferred removal of a cancelled registration) after IoUringIoHandle.handle(...) returned. If the handle threw, the registration was never removed and unregistered() never called, and with this PR hasPendingCancellations() would then stay true so the loop could never suspend.

The bookkeeping now runs in a finally. The exception still reaches the completion loop, which logs it as before. (remove() already decrements the counter before calling unregistered(), so a throwing unregistered() can't leave it stuck.)

New test IoUringEventLoopTest.testCancelledRegistrationWithThrowingCompletionBeforeSuspend: the handle throws on the completion of the outstanding poll, cancel after trySuspend(), then write the eventfd. It fails on c74e15f (unregistered() is never called) and passes with the fix.

Ran on Linux (aarch64, kernel 6.10, native lib built from this branch, -Pleak paranoid): IoUringEventLoopTest, IoUringCustomIoHandleTest, IoUringIoHandler*Test and the IoUringSocket echo/half-closed/rst/connect/EOF tests. 173 tests, 0 failures, no LEAK:. Checkstyle and revapi are clean.

Claude Code on behalf of allthingssecurity

All reactions

Sorry, something went wrong.

Uh oh!

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

@testlens-app

testlens-app Bot commented Oct 14, 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 17743

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

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) ❌ 1% 🟡
KQueueETSocketHalfClosedTest > testAllDataReadClosure(TestInfo) ❌ 2% 🟡

🏷️ Commit: 27a52d3
▶️ Tests: 50097 executed
⚪️ Checks: 26/26 completed

Test Failures

KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(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.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:128)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:114)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:111)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:111)
	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)
KQueueETSocketHalfClosedTest > testAllDataReadClosure(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java11-boringssl build)
java.util.concurrent.TimeoutException: testAllDataReadClosure(org.junit.jupiter.api.TestInfo) timed out after 20000 milliseconds
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	Suppressed: java.lang.InterruptedException
		at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1040)
		at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1345)
		at java.base/java.util.concurrent.CountDownLatch.await(CountDownLatch.java:232)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest.testAllDataReadClosure(SocketHalfClosedTest.java:784)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest.testAllDataReadClosure(SocketHalfClosedTest.java:692)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest$16.run(SocketHalfClosedTest.java:684)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest$16.run(SocketHalfClosedTest.java:681)
		at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest.testAllDataReadClosure(SocketHalfClosedTest.java:681)
		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
		... 2 more

Rerun Controls

Select tests to mute in this pull request:

  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo)
  • KQueueETSocketHalfClosedTest > testAllDataReadClosure(TestInfo)

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.

@normanmaurer
normanmaurer requested a review from franz1981 October 14, 2026 14:31
@normanmaurer

normanmaurer commented Oct 14, 2026

Copy link
Copy Markdown
Member

@dreamlike-ocean PTAL again

All reactions

Sorry, something went wrong.

Uh oh!

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

@allthingssecurity

allthingssecurity commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

The one failing job (macos-aarch64-java11-boringssl) fails in two kqueue tests: KQueueETSocketHalfClosedTest.testAllDataReadClosure (20 s timeout) and KQueueDatagramUnicastIPv6MappedTest.testSimpleSendCompositeDirectByteBuf. Both are listed as intermittent on the test dashboard (#17130). This PR does not change kqueue behaviour: KQueueIoHandler keeps the default hasPendingCancellations() (false), and the loop changes only apply while a loop is suspending, which these tests never do. I built the kqueue native library from this branch and ran both classes plus KQueueEventLoopTest locally on macOS aarch64 with paranoid leak detection: 32 tests, 0 failures, no leaks (testAllDataReadClosure took 3.1 s). The other 26 checks pass. Could someone re-run that job, please?

Claude Code on behalf of allthingssecurity

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.20.Final, 4.2.21.Final Nov 2, 2026
@chrisvest chrisvest modified the milestones: 4.2.21.Final, 4.2.22.Final Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@franz1981 franz1981 Awaiting requested review from franz1981

Uh oh!

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

Assignees

No one assigned

Labels

needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged.

Projects

None yet

Milestone

4.2.22.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

5 participants

@allthingssecurity @normanmaurer @franz1981 @dreamlike-ocean @chrisvest
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.