Switch all-idle timeout to read-idle timeout

idle-timeouts now fire when we haven't read anything from the client
after the configured timeout. This ensures timeouts still fire if
our outbound writes are just being buffered somewhere.

Also, update the default timeout to 1 minute
This commit is contained in:
Ravi Khadiwala authored and Ameya Lokare committed 2026-11-10 13:48:00 -08:00
1 parent 1a36eff391
commit 358fb8e58a
2 files changed
+6 -4

No files matched your search

@@ -14,7 +14,9 @@ import java.time.Duration;
/// @param port The port to bind the omnibus server to
/// @param websocketAddress The address of a listening websocket server for handling legacy requests
/// @param websocketPort The port of a listening websocket server for handling legacy requests
/// @param idleTimeout The duration after which an idle connection may be disconnected
/// @param idleTimeout The duration after which a connection the client has not written to may be disconnected.
/// Clients are expected to send some periodic write traffic (application-level or h2-level
/// pings) to keep otherwise idle connections open
/// @param h2c If true, listen for plaintext h2c with prior-knowledge
/// @param sslProvider The TLS implementation used to terminate TLS. Defaults to `OPENSSL`.
public record GrpcConfiguration(
@@ -34,7 +36,7 @@ public record GrpcConfiguration(
websocketAddress = "localhost";
}
if (idleTimeout == null) {
idleTimeout = Duration.ofMinutes(5);
idleTimeout = Duration.ofSeconds(60);
}
if (sslProvider == null) {
sslProvider = SslProvider.OPENSSL;
@@ -80,7 +80,7 @@ public class OmnibusH2Server implements Managed {
/// @param bindAddress The address the server should listen on
/// @param router How the server should select backends based on request paths
/// @param configurationSupplier Dynamic configuration supplier
/// @param idleTimeout How long to wait before terminating idle TCP connections
/// @param idleTimeout How long to wait since the last data was received from the client before terminating TCP connections
public OmnibusH2Server(
final @Nullable Mapping<String, SslContext> sslContextBySni,
final EventLoopGroup nioEventLoopGroup,
@@ -109,7 +109,7 @@ public class OmnibusH2Server implements Managed {
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(final SocketChannel ch) {
ch.pipeline().addLast(new IdleStateHandler(0, 0, idleTimeout.toMillis(), TimeUnit.MILLISECONDS));
ch.pipeline().addLast(new IdleStateHandler(idleTimeout.toMillis(), 0, 0, TimeUnit.MILLISECONDS));
ch.pipeline().addLast(new SimpleUserEventChannelHandler<IdleStateEvent>() {
@Override
protected void eventReceived(final ChannelHandlerContext ctx, final IdleStateEvent evt) {