You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/01/10 17:45:20 UTC
[tomcat] 02/02: Explicitly release pooled ByteBuffer instances on endpoint stop
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 5d6444553eb1139d90dc32987df98a06a30b5705
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 c9dc0d3..687665b 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 107e591..d5a79cd 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 18ee8a0..4c777c8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -172,6 +172,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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org