Description
What version of Go are you using (go version
)?
1.20.3
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
linux
What did you do?
we use krakend (developed in golang) in our RedHat OpenShift environment and have the following problems with the setup and are looking for support on the following questions. We get these (verbose) log lines from krakend (Go-Application) when the OpenShift internal haproxy makes healthchecks (when using more than one pod). This happend very often:
2023/07/28 08:50:18 http2: server: error reading preface from client <ip>:60524: read tcp <ip>:8443-><ip>:60524: read: connection reset by peer
Tried to disable these with “http2debug”, but in this case it seems that these GODEBUG values will not be used. Thought this will be the case according to this RedHat article - but it does not work:
We reported this issue to the krakend Developers in the Gophers slack channel but it seems to be an issue with the net/http2 package.
Some "research" in the h2_bundle
I found the source of the loglines here. The function used is “condlogf”.
Within this function the following if-case seems to be the decision point for selecting the “vlogf” or the “logf” function. “vlogf” evaluates the variable “http2VerboseLogs” for verbose logging which is set by the http2debug GODEBUG value (btw “logf” will not evaluate this value):
My question: in this case I expected to go into the “vlogf” case (Boring, expected):
This is the function “http2isClosedConnError” with the check if a connection is already closed (with a string contains check):
Should this not be the case in our “reset by peer” too?
Interestingly, in the Windows-case this will be checked too (but not in the posix platform case):
Should this check for the string “use of closed network connection” not be improved with errors.Is? It seems to be possible to check for “reset by peer” error with errors.Is(err, syscall.ECONNRESET).
What do you think?
What did you expect to see?
If not set the GODEBUG value http2debug=1: No verbose log lines in case of "connection reset by peer".
If set the GODEBUG value http2debug=1: Verbose log lines in case of "connection reset by peer".
What did you see instead?
Not set the GODEBUG value http2debug=1: Verbose log lines in case of "connection reset by peer".