-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix race condition in IOUringEventLoop that prevents shutdown #227
Fix race condition in IOUringEventLoop that prevents shutdown #227
Conversation
Motivation: Short lived IOUringEventLoop's can fail to shutdown, being stuck in the read-completion phase. This is because under race conditions we can get a task that skips the submission of the eventFd and then exits. Modifications: - After setting the initial eventfd read event we flush it. This is a one time cost per-loop and avoids the case where a wakeup was requested but never received because the loop enqueued but didn't submit the interest in receiving those event. Result: Less stalled threads on shutdown.
For details about the debugging done to find this see #226 |
transport-classes-io_uring/src/main/java/io/netty/incubator/channel/uring/IOUringEventLoop.java
Outdated
Show resolved
Hide resolved
...ort-native-io_uring/src/test/java/io/netty/incubator/channel/uring/IOUringEventLoopTest.java
Outdated
Show resolved
Hide resolved
...ort-native-io_uring/src/test/java/io/netty/incubator/channel/uring/IOUringEventLoopTest.java
Show resolved
Hide resolved
...ort-native-io_uring/src/test/java/io/netty/incubator/channel/uring/IOUringEventLoopTest.java
Show resolved
Hide resolved
transport-classes-io_uring/src/main/java/io/netty/incubator/channel/uring/IOUringEventLoop.java
Outdated
Show resolved
Hide resolved
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.
Well done!!!
Discussed with @chrisvest offline, and presuming this is good to go, we should port the test to Netty5. |
transport-classes-io_uring/src/main/java/io/netty/incubator/channel/uring/IOUringEventLoop.java
Outdated
Show resolved
Hide resolved
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.
Great work @bryce-anderson
Thanks a lot for fixing it! |
@bryce-anderson can you also open a PR for netty 5 ? |
Motivation:
Short lived IOUringEventLoop's can fail to shutdown, being stuck in the read-completion phase. This is because under race conditions we can get a task that skips the submission of the eventFd and then exits.
Modifications:
Result:
Less stalled threads on shutdown.