usage of deadline conn at Accept() breaks websocket (#19789)

fortunately not wired up to use, however if anyone
enables deadlines for conn then sporadically MinIO
startups fail.
This commit is contained in:
Harshavardhana
2024-05-22 10:49:27 -07:00
committed by GitHub
parent d0e0b81d8e
commit ca80eced24
5 changed files with 10 additions and 55 deletions

View File

@@ -39,10 +39,12 @@ func setTCPParametersFn(opts TCPOptions) func(network, address string, c syscall
_ = unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
{
if opts.SendBufSize > 0 {
// Enable big buffers
_ = unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_SNDBUF, opts.SendBufSize)
}
if opts.RecvBufSize > 0 {
_ = unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_RCVBUF, opts.RecvBufSize)
}

View File

@@ -22,9 +22,6 @@ import (
"fmt"
"net"
"syscall"
"time"
"github.com/minio/minio/internal/deadlineconn"
)
type acceptResult struct {
@@ -75,9 +72,7 @@ func (listener *httpListener) Accept() (conn net.Conn, err error) {
select {
case result, ok := <-listener.acceptCh:
if ok {
return deadlineconn.New(result.conn).
WithReadDeadline(listener.opts.ClientReadTimeout).
WithWriteDeadline(listener.opts.ClientWriteTimeout), result.err
return result.conn, result.err
}
case <-listener.ctx.Done():
}
@@ -122,12 +117,7 @@ func (listener *httpListener) Addrs() (addrs []net.Addr) {
// TCPOptions specify customizable TCP optimizations on raw socket
type TCPOptions struct {
UserTimeout int // this value is expected to be in milliseconds
// When the net.Conn is idle for more than ReadTimeout duration, we close the connection on the client proactively.
ClientReadTimeout time.Duration
// When the net.Conn is idle for more than WriteTimeout duration, we close the connection on the client proactively.
ClientWriteTimeout time.Duration
UserTimeout int // this value is expected to be in milliseconds
SendBufSize int // SO_SNDBUF size for the socket connection, NOTE: this sets server and client connection
RecvBufSize int // SO_RECVBUF size for the socket connection, NOTE: this sets server and client connection
Interface string // This is a VRF device passed via `--interface` flag