Skip to content

Commit 0b828db

Browse files
committed
Merge pull request #16406 from izeye
* pr/16406: Check for Reactor Netty disconnected client errors
2 parents 52ebf20 + 9fae1e5 commit 0b828db

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public abstract class AbstractErrorWebExceptionHandler
6464
* Currently duplicated from Spring WebFlux HttpWebHandlerAdapter.
6565
*/
6666
private static final Set<String> DISCONNECTED_CLIENT_EXCEPTIONS = new HashSet<>(
67-
Arrays.asList("ClientAbortException", "EOFException", "EofException"));
67+
Arrays.asList("AbortedException", "ClientAbortException", "EOFException",
68+
"EofException"));
6869

6970
private static final Log logger = HttpLogging
7071
.forLogName(AbstractErrorWebExceptionHandler.class);
@@ -268,10 +269,14 @@ public Mono<Void> handle(ServerWebExchange exchange, Throwable throwable) {
268269

269270
private boolean isDisconnectedClientError(Throwable ex) {
270271
String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage();
271-
message = (message != null) ? message.toLowerCase() : "";
272-
String className = ex.getClass().getSimpleName();
273-
return (message.contains("broken pipe")
274-
|| DISCONNECTED_CLIENT_EXCEPTIONS.contains(className));
272+
if (message != null) {
273+
String text = message.toLowerCase();
274+
if (text.contains("broken pipe")
275+
|| text.contains("connection reset by peer")) {
276+
return true;
277+
}
278+
}
279+
return DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName());
275280
}
276281

277282
private void logError(ServerRequest request, ServerResponse response,

0 commit comments

Comments
 (0)