diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/GrpcConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/GrpcConfiguration.java index 5c72f25ba..80f905e13 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/GrpcConfiguration.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/GrpcConfiguration.java @@ -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; diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/grpc/net/OmnibusH2Server.java b/service/src/main/java/org/whispersystems/textsecuregcm/grpc/net/OmnibusH2Server.java index 12da6ca31..9e51dcec0 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/grpc/net/OmnibusH2Server.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/grpc/net/OmnibusH2Server.java @@ -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 sslContextBySni, final EventLoopGroup nioEventLoopGroup, @@ -109,7 +109,7 @@ public class OmnibusH2Server implements Managed { .childHandler(new ChannelInitializer() { @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() { @Override protected void eventReceived(final ChannelHandlerContext ctx, final IdleStateEvent evt) {