IoUring: Correctly drain all IO events before shutdown the EventLoop …#14877
Merged
normanmaurer merged 1 commit into4.2from Mar 3, 2025
Merged
IoUring: Correctly drain all IO events before shutdown the EventLoop …#14877normanmaurer merged 1 commit into4.2from
normanmaurer merged 1 commit into4.2from
Conversation
…and so not accepted any more tasks to be scheduled.
Motivation:
We need to ensure we correctly drain all submissions before we allow to shutdown the EventLoop as otherwise we might not be able to cleanly close a Channel when using io_uring.
Missing to do so results in exception during shutdown:
```
[io.netty.channel.AbstractChannel]: Can't invoke task later as EventLoop rejected it
java.util.concurrent.RejectedExecutionException: event executor terminated
at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:1005) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:388) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:381) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:907) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.util.concurrent.SingleThreadEventExecutor.execute0(SingleThreadEventExecutor.java:873) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:863) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.AbstractChannel$AbstractUnsafe.invokeLater(AbstractChannel.java:888) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.AbstractChannel$AbstractUnsafe.deregister(AbstractChannel.java:668) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.AbstractChannel$AbstractUnsafe.fireChannelInactiveAndDeregister(AbstractChannel.java:628) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:611) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.uring.AbstractIoUringChannel$AbstractUringUnsafe.closeNow(AbstractIoUringChannel.java:589) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.uring.AbstractIoUringChannel$AbstractUringUnsafe.handleDelayedClosed(AbstractIoUringChannel.java:499) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.uring.AbstractIoUringChannel$AbstractUringUnsafe.handle(AbstractIoUringChannel.java:425) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.uring.IoUringIoHandler$DefaultIoUringIoRegistration.handle(IoUringIoHandler.java:562) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.uring.IoUringIoHandler.handle(IoUringIoHandler.java:267) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.uring.CompletionQueue.process(CompletionQueue.java:95) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.uring.IoUringIoHandler.destroy(IoUringIoHandler.java:366) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.channel.SingleThreadIoEventLoop.cleanup(SingleThreadIoEventLoop.java:245) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1147) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[x.jar:git:Waterfall-Bootstrap:1.21-R0.1-SNAPSHOT:289f726:unknown]
at java.lang.Thread.run(Thread.java:1575) [?:?]
```
Modifications:
Correctly drain before return from method.
Result:
No more exception during shutdown. Fixes #14872
Member
Author
|
/cc @andreasdc |
So fast fix, keep up the good work! 💪🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…and so not accepted any more tasks to be scheduled.
Motivation:
We need to ensure we correctly drain all submissions before we allow to shutdown the EventLoop as otherwise we might not be able to cleanly close a Channel when using io_uring.
Missing to do so results in exception during shutdown:
Modifications:
Correctly drain before return from method.
Result:
No more exception during shutdown. Fixes #14872