From 330aa704bb41d0e8bbc5ac3e0806fda830fa13a5 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 18 Jul 2017 17:07:21 +0200 Subject: [PATCH] Clean HTTP Resources when NettyWebServer stops This commit is a temporary workaround for gh-9146; it cleans the HTTP resources associated with the Netty server. --- .../boot/web/embedded/netty/NettyWebServer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java b/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java index c9bf5727a9e..896f5dd2897 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java @@ -20,6 +20,7 @@ import java.net.BindException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import reactor.ipc.netty.http.HttpResources; import reactor.ipc.netty.http.server.HttpServer; import reactor.ipc.netty.tcp.BlockingNettyContext; @@ -98,6 +99,8 @@ public class NettyWebServer implements WebServer { public void stop() throws WebServerException { if (this.nettyContext != null) { this.nettyContext.shutdown(); + // temporary fix for gh-9146 + this.nettyContext.getContext().onClose().doOnSuccess(aVoid -> HttpResources.reset()).block(); this.nettyContext = null; } }