FusionAuth/java-http

Debug log Connection reset by peer

Closed this issue · 0 comments

Debug log Connection reset by peer

This can get really noisy when error logging.

PR

Description

For reference, tomcat looks to assume an IOException thrown during read, write or flush (write) is client caused, and wraps the exception so they can debug log it instead of error log.

Here is where they wrap it during read and write

They wrap IOException in ClientAbortException where possible so they can differentiate between a normal IOException and one caused by the client.

In the case of the ClientAbortException - looks like you'd have to enable debug logging to see this type of error.

Here is one spot where Tomcat debug logs this type of exception.

I think we may want to do the same. It is unfortunate that the JDK IOException does not specify if this was client caused or not. The best you can get is an exception message that says Connection reset by peer. However, because this message may be localized, you can't necessarily just do a string compare on this message to know for sure.

Reference: https://stackoverflow.com/a/70222653/3892636