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
Fixes #6043 - Reimplement UnixSocket support based on Java 16. #6522
Conversation
* Introduced new module "jetty-server-unixdomain". It uses reflection to access the Java 16 Unix-Domain classes to keep compatibility with the other modules and the build. * Added Jetty module with only HTTP/1.1 support for now (requires review of the modules to reuse them with various connectors). * Updated documentation to mention UnixDomainServerConnector. * Updated client libraries to support Unix-Domain. * Updated PROXY protocol implementation to support Unix-Domain. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
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'm concerned with hard coding (in config xml) that unix domain is only for raw HTTP. I would expect that other protocols may be carried (eg PROXY from haproxy), so we should set up to be a bit more flexible.
jetty-unixdomain-server/src/main/config/etc/jetty-unixdomain.xml
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.
the profile eclipse-release must be updated as well to enforce usage of jdk16 when releasing
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
...cumentation/src/main/java/org/eclipse/jetty/docs/programming/server/http/HTTPServerDocs.java
Outdated
Show resolved
Hide resolved
...cumentation/src/main/java/org/eclipse/jetty/docs/programming/server/http/HTTPServerDocs.java
Outdated
Show resolved
Hide resolved
jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java
Outdated
Show resolved
Hide resolved
channel.socket().setTcpNoDelay(true); | ||
try | ||
{ | ||
channel.setOption(StandardSocketOptions.TCP_NODELAY, true); |
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 forcing this TCP option by default?
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.
You are right that this should be configurable, but it's covered by #6372.
jetty-io/src/main/java/org/eclipse/jetty/io/ClientConnector.java
Outdated
Show resolved
Hide resolved
/** | ||
* <p>A factory for {@link SocketChannelWithAddress} instances.</p> | ||
*/ | ||
public interface Factory |
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 mechanism won't work for QUIC as it works with DatagramChannel
instead of SocketChannel
.
The SocketChannelWithAddress
class could be modified to hold a SelectableChannel
instead of SocketChannel
but that would not solve the API problem that ClientConnector
already exposes SocketChannel
via configure(SocketChannel channel)
for instance.
This class is sitting between OSI Layer 4 (TCP) and Layer 5 (Sockets, both TCP and Unix Domain), or maybe even overlapping both so I'm not sure I would expose it as an API. Something doesn't look right about it.
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 should probably be a new issue.
jetty-io/src/main/java/org/eclipse/jetty/io/ClientConnector.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/ProxyConnectionFactory.java
Show resolved
Hide resolved
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
…vate. This would make easier to fit QUIC in the future. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@lorban I made the mechanism to create a Unix-Domain I also updated |
// The Unix-Domain path to listen to. | ||
connector.setUnixDomainPath(Path.of("/tmp/jetty.sock")); | ||
|
||
// The TCP accept queue size. |
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 is unrelated to TCP.
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.
better in that out at this stage!
...i/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/FastCGIProxyServletTest.java
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.
might need to disable some tests for windows OS
jetty-unixdomain-server/src/test/java/org/eclipse/jetty/unixdomain/server/UnixDomainTest.java
Show resolved
Hide resolved
.../test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java
Show resolved
Hide resolved
Replaced unix.socket.tmp with better named jetty.unixdomain.dir property. Defaulted jetty.unixdomain.dir property to system property user.home under Windows. Simplified code that runs Unix-Domain tests. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixed Unix-Domain profile for Windows. Fixed test to make it work on Windows. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
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.
Tested on Windows 10 laptop, works as expected.
@olamy this PR now runs fine on Windows too. |
It uses reflection to access the Java 16 Unix-Domain classes to keep compatibility with the other modules and the build.
Signed-off-by: Simone Bordet simone.bordet@gmail.com