-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Add unix domain socket transport in netty 4.x via JDK16+ #13965
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
Conversation
|
This patch was created by @honglh with some feedback from me. @honglh works for Oracle, though on a different team than me. They want to get the Micronaut HTTP server (and thus netty) working with domain sockets without epoll. I will help on cleaning up this PR (commit message, compatibility, javadocs, builds, JDK version checks, CLA…) assuming you agree that the general approach is acceptable in netty 4. While this approach is not compatible with the existing kqueue and epoll domain socket implementations (this patch uses the JDK UnixDomainSocketAddress rather than the netty DomainSocketAddress that kqueue and epoll use), I think this tradeoff is reasonable to keep project layout changes to a minimum. Other than that I have no concerns with this approach. |
|
@yawkat let me have a look and come back to you early next week |
|
/cc @chrisvest |
|
Thanks @normanmaurer ! Mostly looks fine to me. I've tested it locally and it works, except for the use case we already had a problem with in #13877. When directly constructing a NioDomainServerSocketChannel from a ServerSocketChannel (eg from System.inheritedChannel), and then only registering (not binding) the channel (eg systemd socket activation use case), the channel remains inactive because Another nit: NioDomainServerSocketChannel vs EpollServerDomainSocketChannel, the server and domain are flipped. |
|
@yawkat fixed the naming... let me check what we can do about the "bound" stuff here. |
|
@normanmaurer the link at the bottom of https://docs.google.com/forms/d/e/1FAIpQLSfXTK6SnWWFbR50DFhoZq2floCFOUBH3kG8sZP77im5Rknctg/viewform?formkey=dG9wTmhoeGNGd1MtdFdtVXl4TlVSNlE6MQ to change the list of employees is broken |
|
@yawkat I just pushed a commit that will allow to correctly detect if a channel was bound before. Also added some tests |
|
You haven't |
|
@yawkat 🤦 now I did :D |
|
Thanks! I tried locally, and it works out of the box now. Otherwise this PR LGTM, we just need to get the CLA sorted on our end. |
@trustin will fix it. |
|
@chrisvest PTAL |
chrisvest
left a comment
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.
Looks good. I had some comments, though.
transport/src/main/java/io/netty/channel/socket/nio/NioDomainSocketChannel.java
Outdated
Show resolved
Hide resolved
transport/src/main/java/io/netty/channel/socket/nio/NioDomainSocketChannel.java
Outdated
Show resolved
Hide resolved
transport/src/main/java/io/netty/channel/socket/nio/NioDomainSocketChannel.java
Outdated
Show resolved
Hide resolved
transport/src/main/java/io/netty/channel/socket/nio/NioDomainSocketChannel.java
Outdated
Show resolved
Hide resolved
transport/src/main/java/io/netty/channel/socket/nio/NioDomainSocketChannel.java
Show resolved
Hide resolved
transport/src/main/java/io/netty/channel/socket/nio/NioServerDomainSocketChannel.java
Show resolved
Hide resolved
transport/src/main/java/io/netty/channel/socket/nio/NioServerDomainSocketChannel.java
Outdated
Show resolved
Hide resolved
transport/src/main/java/io/netty/channel/socket/nio/NioServerDomainSocketChannel.java
Outdated
Show resolved
Hide resolved
transport/src/main/java/io/netty/channel/socket/nio/NioServerDomainSocketChannel.java
Outdated
Show resolved
Hide resolved
transport/src/test/java/io/netty/channel/socket/nio/NioServerDomainSocketChannelTest.java
Outdated
Show resolved
Hide resolved
|
Thanks for your patience, @yawkat. Here's the employee list update form: https://docs.google.com/forms/d/e/1FAIpQLScnQObZBItRc5L9EC_DPB3WVdUA7K_uIgC-I7gxqq3G4JGySQ/viewform |
|
Will do, I've sent the CLA upstairs :) |
|
CLA should be submitted. Note that the Oracle Point of Contact also changed. |
|
Thanks all ! |
### Motivation: Our use case requires using nio transport for unix-domain-socket (UDS) in netty 4.x. Although netty 5.x supports UDS, it is is not compatible with 4.x. For us and probably many users, having to migrate to 5.x in order to use UDS is not a viable option. ### Modification: Add new classes to support domain UDS with NIO. ### Result: UDS is supported when using the NIO transport when java 16+ is used. Co-authored-by: Norman Maurer <[email protected]>
|
Thanks! |
* fix(deps): update netty monorepo to v4.1.110.final * NIO domain socket support From netty/netty#13965 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
### What changes were proposed in this pull request? The pr aims to upgrade `netty` from `4.1.109.Final` to `4.1.110.Final`. ### Why are the changes needed? - https://netty.io/news/2024/05/22/4-1-110-Final.html This version has brought some bug fixes and improvements, such as: Fix Zstd throws Exception on read-only volumes (netty/netty#13982) Add unix domain socket transport in netty 4.x via JDK16+ ([#13965](netty/netty#13965)) Backport #13075: Add the AdaptivePoolingAllocator ([#13976](netty/netty#13976)) Add no-value key handling only for form body ([#13998](netty/netty#13998)) Add support for specifying SecureRandom in SSLContext initialization ([#14058](netty/netty#14058)) - https://github.com/netty/netty/issues?q=milestone%3A4.1.110.Final+is%3Aclosed ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass GA. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #46744 from panbingkun/SPARK-48420. Authored-by: panbingkun <[email protected]> Signed-off-by: yangjie01 <[email protected]>
Motivation:
Our use case requires using nio transport for unix-domain-socket (UDS) in netty 4.x.
Although netty 5.x supports UDS, it is is not compatible with 4.x. For us and probably many users, having to migrate to 5.x in order to use UDS is not a viable option.
#10991 says it is supported in 5.x and explains the complexity of doing so in 4.x.
Here, I am proposing a simpler way of adding to 4.x using JDK16+ NIO transport.
The simplicity is achieved by allowing
NioServerSocketChannelto continue to support INET only and use new classes for UDS.This UDS support in this (4.x) PR is incompatible with 5.x. But since 5.x is incompatible with 4.x anyway, I don't this is is an issue. It is easy for user to change to use UDS from 5.x when it comes to it.
Thus in summary, this change
Modification:
Only a few APIs are overloaded to support NIO UDS class.
Most changes are added new files.
Describe the modifications you've done.
The
NioServerSocketChannelandNioSocketChannelsupports only INET channels. In this PR mirroring classes for NIO UDSNioDomainServerSocketChannelandNioDomainSocketChannelare added.I modified EchoServer.java to use newly created
NioDomainServerSocketChannelto show the difference creating a EchoServer with INET socket and with UDS socket.Result:
This is a draft PR, so POM changes to use JDK16+ to build netty-transport are not included.
The EchoServer with UDS works as expected and same as it is using INET
Fixes #.
If there is no issue then describe the changes introduced by this PR.