harbor icon indicating copy to clipboard operation
harbor copied to clipboard

nginx-python send RST package to client cause EOF

Open suchen-sci opened this issue 4 months ago • 3 comments

Hi Team,

We are currently running the Harbor project using Docker Compose. When accessing Nginx-Python with our Golang client, we have encountered an issue where, approximately every few hours, the client experiences an EOF error. Upon investigating with tcpdump, we observed that about one minute after the request, Nginx-Python sometimes sends a RST packet to the client, which results in the Golang client receiving an EOF.

Could you please provide any advice or insights on how to resolve this issue?

Below are the settings for our Golang client:

func HTTPClient(tlsCfg *tls.Config) *http.Client {
	dialFunc := func(ctx stdctx.Context, network, addr string) (net.Conn, error) {
		return (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 60 * time.Second,
		}).DialContext(ctx, network, addr)
	}

	client := &http.Client{
		Transport: &http.Transport{
			Proxy:              http.ProxyFromEnvironment,
			DialContext:        dialFunc,
			TLSClientConfig:    tlsCfg,
			DisableCompression: false,
			// NOTE: The large number of Idle Connections can
			// reduce overhead of building connections.
			IdleConnTimeout:       90 * time.Second,
			TLSHandshakeTimeout:   10 * time.Second,
			ExpectContinueTimeout: 1 * time.Second,
		},
	}
	return client
}

Thanks a lot!

suchen-sci avatar Sep 26 '24 03:09 suchen-sci