From 9fae1e5d0e305a0868494755862d4063772687ba Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 2 Apr 2019 15:23:58 +0900 Subject: [PATCH] Check for Reactor Netty disconnected client errors Closes gh-16046 --- .../error/AbstractErrorWebExceptionHandler.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java index 03ce482c11..a4586ed130 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java @@ -64,7 +64,8 @@ public abstract class AbstractErrorWebExceptionHandler * Currently duplicated from Spring WebFlux HttpWebHandlerAdapter. */ private static final Set DISCONNECTED_CLIENT_EXCEPTIONS = new HashSet<>( - Arrays.asList("ClientAbortException", "EOFException", "EofException")); + Arrays.asList("AbortedException", "ClientAbortException", "EOFException", + "EofException")); private static final Log logger = HttpLogging .forLogName(AbstractErrorWebExceptionHandler.class); @@ -268,10 +269,14 @@ public abstract class AbstractErrorWebExceptionHandler private boolean isDisconnectedClientError(Throwable ex) { String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage(); - message = (message != null) ? message.toLowerCase() : ""; - String className = ex.getClass().getSimpleName(); - return (message.contains("broken pipe") - || DISCONNECTED_CLIENT_EXCEPTIONS.contains(className)); + if (message != null) { + String text = message.toLowerCase(); + if (text.contains("broken pipe") + || text.contains("connection reset by peer")) { + return true; + } + } + return DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName()); } private void logError(ServerRequest request, ServerResponse response,