-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Server should NOT open connectors early in start sequence #12047
Comments
This is controversial, as the cloud providers and docker/k8s users prefer early open. |
Why do they prefer an early open? Anyway, I guess a configuration option makes sense that allows to skip early open? |
This is a sensible solution. |
Some webapps can take longer to deploy (scanning, init, etc) than the timeouts for those services. |
PR #12049 merged. |
Jetty version(s)
10.x, 11.x, 12.x
Jetty Environment
core
Java version/vendor
(use: java -version)
17.0.11 / any
OS type/version
macOS / any
Description
Jetty 10.x introduced an enhancement to open network sockets early in the start sequence: #2103. I guess this is preferable to fail early in case the network address is not available?
Unfortunately, this behavior is problematic for clients. For them it looks like the server hangs, because their network connections are accepted, but nothing happens. In my case the client is an Nginx instance that has two Jetty instances defined as upstreams. If one of them fails to connect, Nginx will try on the other server.
With Jetty 10-12 this won't work properly, because Nginx connects fine in case one of the upstreams is still starting, but then doesn't get a response and fails upon the read timeout (instead of failing at the connect timeout like it did with Jetty 9).
How to reproduce?
Run the below Java code and run
curl
during the start phase of Jetty (within the sleep period). With Jetty 9 this will result inCouldn't connect to server
, while on Jetty 10-12 this will hang until the server is started and then return a response.I managed to work around this issue by removing all connectors and re-adding them in the start sequence, but this seems like a very ugly hack. The code needs to be inserted right before
server.start();
in the above example.The text was updated successfully, but these errors were encountered: