storj/pkg/server
Jeff Wendling 828d0b9984 pkg/server: set TCP_USER_TIMEOUT and monitor leaked conns
Go will, by default, set tcp keep alives on sockets. But
the kernel does not send keep alives to sockets that have
a non-empty send queue. That can cause connections that
hang forever.

So we set TCP_USER_TIMEOUT on all of the sockets as well.
That option will close any connection that has not received
an ack for any sent data (keep alive or otherwise) in the
configured time period. This places an upper bound on the
amount of time a socket can be stuck due to a client not
acknowleding data.

See https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/
for more information on what these options do and how they
interact.

Additionally, make sure that we close every connection coming
from the listeners by wrapping them in a type with a finalizer
that closes the connection, much like the os package does for
file handles. It monitors if a connection was closed due to a
finalizer so that we can go and look for the bug if we ever
see a non-zero value.

Change-Id: Idc6c0564224b8dc2e4c9d769e80374ed1fe8cce0
2020-01-03 21:31:09 +00:00
..
common.go pkg: Align errs Class messages (#2485) 2019-07-08 17:37:12 -04:00
config.go common: separate repository 2019-12-27 14:11:15 +02:00
interceptors.go common: separate repository 2019-12-27 14:11:15 +02:00
listener_linux.go pkg/server: set TCP_USER_TIMEOUT and monitor leaked conns 2020-01-03 21:31:09 +00:00
listener_other.go pkg/server: set TCP_USER_TIMEOUT and monitor leaked conns 2020-01-03 21:31:09 +00:00
server.go pkg/server: set TCP_USER_TIMEOUT and monitor leaked conns 2020-01-03 21:31:09 +00:00