From ce02d5a1848458f9f9904728d6eb1a82df62f87a Mon Sep 17 00:00:00 2001 From: JStroom Date: Fri, 16 Nov 2018 10:32:34 +0100 Subject: [PATCH] Update SslHandler.java (#8564) Swallow SSL Exception "closing inbound before receiving peer's close_notify" when running on Java 11 (#8463) Motivation: When closing a inbound SSL connection before the remote peer has send a close notify, the Java JDK is trigger happy to throw an exception. This exception can be ignored since the connection is about to be closed. The exception wasn't printed in Java 8, based on filtering on the exception message. In Java 11 the exception message has been changed. Modifications: Update the if statement to also filter/swallow the message on Java 11. Result: On Java 11 the exception isn't printed with log levels set to debug. The old behaviour is maintained. --- handler/src/main/java/io/netty/handler/ssl/SslHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java index f375bc2358..fe533735e6 100644 --- a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java +++ b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java @@ -1570,7 +1570,8 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH // // See https://github.com/netty/netty/issues/1340 String msg = e.getMessage(); - if (msg == null || !msg.contains("possible truncation attack")) { + if (msg == null || !(msg.contains("possible truncation attack") || + msg.contains("closing inbound before receiving peer's close_notify"))) { logger.debug("{} SSLEngine.closeInbound() raised an exception.", ctx.channel(), e); } }