-
Notifications
You must be signed in to change notification settings - Fork 40.4k
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
Deprecate server.connection-timeout and create server-specific configuration keys #18473
Comments
It's hard to come up with a property description that fits 100% with subtle behavior of each server. For Tomcat, we're setting the
Which also sets the
For Jetty, we're setting the
Undertow with
With Netty, As far as I understand, the With the current situation, I don't see how we could improve the behavior or the documentation. Let us know what you think! |
Yeah, it is tricky, although I think the behaviour that is currently implemented for Jetty is also consistent with IdleStateHandler (it is an idle timeout that applies even during request handling, if no progress is made i.e. there are no reads/writes): /**
* <p>Sets the maximum Idle time for a connection, which roughly translates to the {@link Socket#setSoTimeout(int)}
* call, although with NIO implementations other mechanisms may be used to implement the timeout.</p>
* <p>The max idle time is applied:</p>
* <ul>
* <li>When waiting for a new message to be received on a connection</li>
* <li>When waiting for a new message to be sent on a connection</li>
* </ul>
* <p>This value is interpreted as the maximum time between some progress being made on the connection.
* So if a single byte is read or written, then the timeout is reset.</p>
*
* @param idleTimeout the idle timeout
*/ |
I'm don't actually think Netty's The code path in (Edit: confirmed this in a debugger - the method that checks |
I agree there's a problem here, we're not really consistent and worse, not doing the right thing for Netty. Maybe we could remove Undertow has a dedicated
We could keep using Jetty's But with Tomcat, we might be stuck with I've marked this issue for discussion with the team. |
Thanks, yeah, I don't know what the best solution is either. The current Tomcat/Undertow
|
We've discussed that during a team call and we think that, given servers might have subtle behavior difference even for similar configuration keys, we should:
Thanks for your input @joedj ! |
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html documents
server.connection-timeout
as "Time that connectors wait for another HTTP request before closing the connection. When not set, the connector's container-specific default is used. Use a value of -1 to indicate no (that is, an infinite) timeout".Support for this property was added for Netty, in Issue #15368 / PR #15385
This was done using
ChannelOption.CONNECT_TIMEOUT_MILLIS
, which does not implement the described functionality. As far as I can tell,CONNECT_TIMEOUT_MILLIS
is the timeout for the TCP connection handshake.The correct way to implement the documented functionality (i.e. an idle/keep-alive timeout) appears to be using Netty's IdleStateHandler.
An example of doing this in a
WebServerFactoryCustomizer
might look something like this:The text was updated successfully, but these errors were encountered: