Skip to content

Should we be swallowing and optionally debug logging Connection reset by peer socket exceptions? #39

@robotdan

Description

@robotdan

Should we be swallowing and optionally debug logging Connection reset by peer socket exceptions?

Example exception:

java.net.SocketException: Connection reset by peer
	at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method)
	at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:62)
	at java.base/sun.nio.ch.NioSocketImpl.tryWrite(NioSocketImpl.java:394)
	at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:413)
	at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:440)
	at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:819)
	at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1195)
	at io.fusionauth.http.server.io.ThroughputOutputStream.write(ThroughputOutputStream.java:60)
	at io.fusionauth.http.server.io.HTTPOutputStream$ServerToSocketOutputStream.forceFlush(HTTPOutputStream.java:298)
	at io.fusionauth.http.server.io.HTTPOutputStream$ServerToSocketOutputStream.write(HTTPOutputStream.java:326)
	at io.fusionauth.http.io.ChunkedOutputStream.flush(ChunkedOutputStream.java:68)
	at io.fusionauth.http.io.ChunkedOutputStream.write(ChunkedOutputStream.java:91)
	at io.fusionauth.http.server.io.HTTPOutputStream.write(HTTPOutputStream.java:148)

Generally speaking since we can't control the client, and they could choose to close a socket whenever they wish, I think this type of exception should be expected and just debug logged.

For example, Tomcat wraps these types of exceptions in ClientAbortException

And then catches that type and ignores it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions