Skip to content

Commit

Permalink
Support all "connection reset" phrases in DisconnectedClientHelper
Browse files Browse the repository at this point in the history
Prior to this commit, the isClientDisconnectedException() method in
DisconnectedClientHelper checked whether the message of the ultimate
exception in an exception chain contained one of the phrases "broken
pipe" or "connection reset by peer". However, that failed to match if
the exception message contained "Connection reset", which is the case
for the SocketException thrown by throwConnectionReset() in
sun.nio.ch.SocketChannelImpl.

This commit therefore replaces the "connection reset by peer" phrase
with "connection reset" in order to support all exception messages
containing "connection reset".

Closes gh-33064
  • Loading branch information
sbrannen committed Jun 18, 2024
1 parent 9a56a88 commit 203fa75
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class DisconnectedClientHelper {

private static final Set<String> EXCEPTION_PHRASES =
Set.of("broken pipe", "connection reset by peer");
Set.of("broken pipe", "connection reset");

private static final Set<String> EXCEPTION_TYPE_NAMES =
Set.of("AbortedException", "ClientAbortException",
Expand Down Expand Up @@ -73,11 +73,12 @@ else if (logger.isDebugEnabled()) {

/**
* Whether the given exception indicates the client has gone away.
* Known cases covered:
* <p>Known cases covered:
* <ul>
* <li>ClientAbortException or EOFException for Tomcat
* <li>EofException for Jetty
* <li>IOException "Broken pipe" or "connection reset by peer"
* <li>SocketException "Connection reset"
* </ul>
*/
public static boolean isClientDisconnectedException(Throwable ex) {
Expand Down

0 comments on commit 203fa75

Please sign in to comment.