Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when serving connection "x.x.x.x:443"<->"172.56.198.126:18271": EOF #1758

Open
mlb4428675 opened this issue Apr 14, 2024 · 3 comments
Open

Comments

@mlb4428675
Copy link

mlb4428675 commented Apr 14, 2024

Hi guys,

We use fasthttp to implement http and https services. From testing I find the http service can handle 20,000 QPS with about 40-45% CPU. However, I saw many https errors in the error log, but no http error. For example:

2024/04/14 15:18:34 error when serving connection "x.x.x.x:443"<->"24.239.113.227:64266": read tcp4 x.x.x.x:443->24.239.113.227:64266: i/o timeout
2024/04/14 15:18:34 error when serving connection "x.x.x.x:443"<->"209.239.103.95:48842": read tcp4 x.x.x.x:443->209.239.103.95:48842: i/o timeout
2024/04/14 15:18:38 error when serving connection "x.x.x.x:443"<->"73.37.175.237:55178": EOF
2024/04/14 15:18:38 error when serving connection "x.x.x.x:443"<->"73.50.53.66:54914": EOF
2024/04/14 15:18:39 error when serving connection "x.x.x.x:443"<->"2.219.251.200:63288": EOF
2024/04/14 15:18:40 error when serving connection "x.x.x.x:443"<->"108.145.161.68:21544": EOF
2024/04/14 15:18:45 error when serving connection "x.x.x.x:443"<->"172.56.198.126:18271": EOF
2024/04/14 15:18:45 error when serving connection "x.x.x.x:443"<->"76.99.128.124:52915": read tcp4 x.x.x.x:443->76.99.128.124:52915: i/o timeout
2024/04/14 15:18:45 error when serving connection "x.x.x.x:443"<->"194.223.42.125:51590": read tcp4 x.x.x.x:443->194.223.42.125:51590: i/o timeout
2024/04/14 15:18:47 error when serving connection "x.x.x.x:443"<->"161.216.164.35:57059": read tcp4 x.x.x.x:443->161.216.164.35:57059: i/o timeout
2024/04/14 15:18:48 error when serving connection "x.x.x.x:443"<->"165.165.120.93:60080": read tcp4 x.x.x.x:443->165.165.120.93:60080: i/o timeout
2024/04/14 15:18:48 error when serving connection "x.x.x.x:443"<->"76.145.183.220:54072": EOF
2024/04/14 15:18:52 error when serving connection "x.x.x.x:443"<->"74.56.40.3:50533": EOF
2024/04/14 15:18:52 error when serving connection "x.x.x.x:443"<->"216.152.187.86:50748": EOF
2024/04/14 15:18:52 error when serving connection "x.x.x.x:443"<->"161.216.164.152:39345": read tcp4 x.x.x.x:443->161.216.164.152:39345: i/o timeout
2024/04/14 15:18:53 error when serving connection "x.x.x.x:443"<->"96.234.173.11:55128": EOF
2024/04/14 15:18:53 error when serving connection "x.x.x.x:443"<->"76.49.122.157:56297": EOF
2024/04/14 15:18:54 error when serving connection "x.x.x.x:443"<->"71.7.113.91:61892": read tcp4 x.x.x.x:443->71.7.113.91:61892: read: connection reset by peer
2024/04/14 15:18:54 error when serving connection "x.x.x.x:443"<->"83.59.254.161:54836": EOF
2024/04/14 15:18:55 error when serving connection "x.x.x.x:443"<->"71.129.74.178:53145": EOF
2024/04/14 15:18:56 error when serving connection "x.x.x.x:443"<->"73.170.32.107:64919": EOF
2024/04/14 15:18:56 error when serving connection "x.x.x.x:443"<->"84.83.200.178:64587": EOF

The config information is here:

	httpsPort := ":443"
	httpsServer := &fasthttp.Server{
		Handler:        handler,
		IdleTimeout:    35 * time.Second,
		ReadTimeout:    30 * time.Second,
		WriteTimeout:   10 * time.Second,
		ReadBufferSize: 8 * 1024,
		Concurrency:    256 * 1024,
		TLSConfig:      tlsConfig,
		LogAllErrors:   true,
	}

	go func() {
		if err := httpsServer.ListenAndServeTLS(httpsPort, "", ""); err != nil {
			log.Fatalf("Error in HTTPS server: %s", err)
		}
	}()

I would like advice on how I can troubleshoot this error and resolve it.
thanks!

@erikdubbelboer
Copy link
Collaborator

It's hard to say. It could for example be http clients trying to connect to a https endpoint. It could be bots. It could be clients that can't handle certificate.

@mlb4428675
Copy link
Author

thanks, but how can I get the whole URL of the request that has experienced such error, in error log, only a message "2024/04/14 15:18:38 error when serving connection "x.x.x.x:443"<->"73.37.175.237:55178": EOF".

@erikdubbelboer
Copy link
Collaborator

The problem is that at this point you don't have a URL. It could happen at any point in the request cycle where maybe the URL hasn't been received yet.

It might be interesting to try and amend the errors here with a URL if that's already received:

fasthttp/header.go

Lines 2714 to 2724 in d3aa5a1

return 0, err
}
h.rawHeaders, _, err = readRawHeaders(h.rawHeaders[:0], buf[m:])
if err != nil {
return 0, err
}
var n int
n, err = h.parseHeaders(buf[m:])
if err != nil {
return 0, err

But I'm afraid I don't have time to look into this at the moment. But I would be open to a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants