Skip to content

Commit 203fa75

Browse files
committed
Support all "connection reset" phrases in DisconnectedClientHelper
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
1 parent 9a56a88 commit 203fa75

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-web/src/main/java/org/springframework/web/util/DisconnectedClientHelper.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public class DisconnectedClientHelper {
3737

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

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

7474
/**
7575
* Whether the given exception indicates the client has gone away.
76-
* Known cases covered:
76+
* <p>Known cases covered:
7777
* <ul>
7878
* <li>ClientAbortException or EOFException for Tomcat
7979
* <li>EofException for Jetty
8080
* <li>IOException "Broken pipe" or "connection reset by peer"
81+
* <li>SocketException "Connection reset"
8182
* </ul>
8283
*/
8384
public static boolean isClientDisconnectedException(Throwable ex) {

0 commit comments

Comments
 (0)