From 31b5acc245f4fa35abb5a79792cdedd4177838aa Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Thu, 27 Apr 2023 01:48:31 +0100 Subject: [PATCH] tcp: Increase user timeout to 10 minutes (#17087) --- internal/http/dial_linux.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/http/dial_linux.go b/internal/http/dial_linux.go index 7d61cae1c..2ab7ded7e 100644 --- a/internal/http/dial_linux.go +++ b/internal/http/dial_linux.go @@ -67,8 +67,9 @@ func setTCPParameters(network, address string, c syscall.RawConn) error { // Set tcp user timeout in addition to the keep-alive - tcp-keepalive is not enough to close a socket // with dead end because tcp-keepalive is not fired when there is data in the socket buffer. // https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/ - // This is a sensitive configuration, it is better to set it to high values, > 60 secs - _ = syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, (15+5*15)*1000) + // This is a sensitive configuration, it is better to set it to high values, > 60 secs since it can + // affect clients reading data with a very slow pace (disappropriate with socket buffer sizes) + _ = syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, 10*60*1000) }) return nil }