This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit f98ad7a84c0e760a380fc4f204788b44c835cfe1 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Jan 10 17:45:07 2022 +0000 Explicitly release pooled ByteBuffer instances on endpoint stop --- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 5 ++++- java/org/apache/tomcat/util/net/NioEndpoint.java | 5 ++++- webapps/docs/changelog.xml | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java index 8388c50..00719a6 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -209,7 +209,10 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS } }); if (nioChannels != null) { - nioChannels.clear(); + Nio2Channel socket; + while ((socket = nioChannels.pop()) != null) { + socket.free(); + } nioChannels = null; } if (processorCache != null) { diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 4e6986c..7ef9f4a 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -319,7 +319,10 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> eventCache = null; } if (nioChannels != null) { - nioChannels.clear(); + NioChannel socket; + while ((socket = nioChannels.pop()) != null) { + socket.free(); + } nioChannels = null; } if (processorCache != null) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 14b11a1..7a9829f 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -163,6 +163,10 @@ and new requests on existing connections are stopped while allowing in progress requests to run to completion. (markt) </fix> + <fix> + Explicitly release ByteBuffer instances associated with pooled channels + when stopping the NioEndpoint and Nio2Endpoint. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org