Skip to content

Commit

Permalink
Merge pull request #16406 from izeye
Browse files Browse the repository at this point in the history
* pr/16406:
  Check for Reactor Netty disconnected client errors
  • Loading branch information
snicoll committed Apr 3, 2019
2 parents 52ebf20 + 9fae1e5 commit 0b828db
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public abstract class AbstractErrorWebExceptionHandler
* Currently duplicated from Spring WebFlux HttpWebHandlerAdapter.
*/
private static final Set<String> 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);
Expand Down Expand Up @@ -268,10 +269,14 @@ public Mono<Void> handle(ServerWebExchange exchange, Throwable throwable) {

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,
Expand Down

0 comments on commit 0b828db

Please sign in to comment.