Skip to content

x/net/http2: server too verbose logging in case of "connection reset by peer" on posix platforms #61684

Open
@0xC001C0DEBA5E

Description

@0xC001C0DEBA5E

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:
image
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”.
image

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):
image

My question: in this case I expected to go into the “vlogf” case (Boring, expected):
image

This is the function “http2isClosedConnError” with the check if a connection is already closed (with a string contains check):
image
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):
image
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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions