Re: JDK 18: Rampdown Phase 1 & Early-Access builds 27
On 20/12/2021 12:33, Rémy Maucherat wrote: I'm seeing a difference with the new Java versions that will need some attention, with this stack trace occurring on shutdown: 20-Dec-2021 13:26:40.235 WARNING [Thread-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesObjectStreamClassCaches Failed to clear soft references from ObjectStreamClass$Caches for web application [docs] java.lang.ClassCastException: class java.io.ObjectStreamClass$Caches$1 cannot be cast to class java.util.Map (java.io.ObjectStreamClass$Caches$1 and java.util.Map are in module java.base of loader 'bootstrap') at org.apache.catalina.loader.WebappClassLoaderBase.clearCache(WebappClassLoaderBase.java:2340) I see the change in the JDK repo but it hasn't been back-ported to an EA release yet. I wonder if this is planned for Java 19? My current thinking is to wait to address this until the change makes its way into a EA release. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Expand on fix for BZ 65757 - check for specific request thread
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 The following commit(s) were added to refs/heads/main by this push: new c760349 Expand on fix for BZ 65757 - check for specific request thread c760349 is described below commit c760349e41d26b3bde61699e568a8178f9b6ed10 Author: Mark Thomas AuthorDate: Mon Jan 10 13:40:58 2022 + Expand on fix for BZ 65757 - check for specific request thread Previous check was for any container thread. New check looks for the specific container thread currently assigned to the request/response. --- java/org/apache/coyote/AbstractProtocol.java | 4 java/org/apache/coyote/AsyncStateMachine.java | 10 +++--- java/org/apache/coyote/ContainerThreadMarker.java | 3 +++ .../http11/upgrade/UpgradeServletInputStream.java | 5 +++-- .../http11/upgrade/UpgradeServletOutputStream.java | 5 +++-- java/org/apache/coyote/http2/StreamProcessor.java | 3 --- .../tomcat/util/net/ContainerThreadMarker.java | 3 +++ .../catalina/nonblocking/TestNonBlockingAPI.java | 23 -- webapps/docs/changelog.xml | 6 ++ 9 files changed, 46 insertions(+), 16 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index c8af0d2..c286a23 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -798,8 +798,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, return SocketState.CLOSED; } -ContainerThreadMarker.set(); - try { if (processor == null) { String negotiatedProtocol = wrapper.getNegotiatedProtocol(); @@ -1017,8 +1015,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, // with "ERROR" level, so it will show up even on // less-than-verbose logs. getLog().error(sm.getString("abstractConnectionHandler.error"), e); -} finally { -ContainerThreadMarker.clear(); } // Make sure socket/processor is removed from the list of current diff --git a/java/org/apache/coyote/AsyncStateMachine.java b/java/org/apache/coyote/AsyncStateMachine.java index 3176246..472a48b 100644 --- a/java/org/apache/coyote/AsyncStateMachine.java +++ b/java/org/apache/coyote/AsyncStateMachine.java @@ -305,7 +305,8 @@ class AsyncStateMachine { synchronized boolean asyncComplete() { -if (!ContainerThreadMarker.isContainerThread() && +Request request = processor.getRequest(); +if ((request == null || !request.isRequestThread()) && (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP)) { updateState(AsyncState.COMPLETE_PENDING); return false; @@ -367,7 +368,8 @@ class AsyncStateMachine { synchronized boolean asyncDispatch() { -if (!ContainerThreadMarker.isContainerThread() && +Request request = processor.getRequest(); +if ((request == null || !request.isRequestThread()) && (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP)) { updateState(AsyncState.DISPATCH_PENDING); return false; @@ -436,7 +438,9 @@ class AsyncStateMachine { } else { updateState(AsyncState.ERROR); } -return !ContainerThreadMarker.isContainerThread(); + +Request request = processor.getRequest(); +return request == null || !request.isRequestThread(); } diff --git a/java/org/apache/coyote/ContainerThreadMarker.java b/java/org/apache/coyote/ContainerThreadMarker.java index 0ba2ef0..2d651b3 100644 --- a/java/org/apache/coyote/ContainerThreadMarker.java +++ b/java/org/apache/coyote/ContainerThreadMarker.java @@ -21,7 +21,10 @@ package org.apache.coyote; * data from an incoming connection. Application created threads are not * container threads and neither are threads taken from the container thread * pool to execute AsyncContext.start(Runnable). + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x */ +@Deprecated public class ContainerThreadMarker { public static boolean isContainerThread() { diff --git a/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java b/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java index b3b7fb5..63ad3f4 100644 --- a/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java +++ b/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java @@ -21,7 +21,7 @@ import java.io.IOException; import jakarta.servlet.ReadListener; import jakarta.servlet.ServletInputStream; -import org.apache.coyote.ContainerThreadMarker; +import org.apache.coyote.Request;
[tomcat] branch main updated: Remove deprecated code
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 The following commit(s) were added to refs/heads/main by this push: new 629518d Remove deprecated code 629518d is described below commit 629518d613561b4fdf9cf3e1b30b66605886ff46 Author: Mark Thomas AuthorDate: Mon Jan 10 13:41:55 2022 + Remove deprecated code --- java/org/apache/coyote/ContainerThreadMarker.java | 41 -- .../tomcat/util/net/ContainerThreadMarker.java | 48 -- 2 files changed, 89 deletions(-) diff --git a/java/org/apache/coyote/ContainerThreadMarker.java b/java/org/apache/coyote/ContainerThreadMarker.java deleted file mode 100644 index 2d651b3..000 --- a/java/org/apache/coyote/ContainerThreadMarker.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.coyote; - -/** - * Used to mark threads that have been allocated by the container to process - * data from an incoming connection. Application created threads are not - * container threads and neither are threads taken from the container thread - * pool to execute AsyncContext.start(Runnable). - * - * @deprecated Unused. Will be removed in Tomcat 10.1.x - */ -@Deprecated -public class ContainerThreadMarker { - -public static boolean isContainerThread() { -return org.apache.tomcat.util.net.ContainerThreadMarker.isContainerThread(); -} - -public static void set() { -org.apache.tomcat.util.net.ContainerThreadMarker.set(); -} - -public static void clear() { -org.apache.tomcat.util.net.ContainerThreadMarker.clear(); -} -} diff --git a/java/org/apache/tomcat/util/net/ContainerThreadMarker.java b/java/org/apache/tomcat/util/net/ContainerThreadMarker.java deleted file mode 100644 index 7149945..000 --- a/java/org/apache/tomcat/util/net/ContainerThreadMarker.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tomcat.util.net; - -/** - * Used to mark threads that have been allocated by the container to process - * data from an incoming connection. Application created threads are not - * container threads and neither are threads taken from the container thread - * pool to execute AsyncContext.start(Runnable). - * - * @deprecated Unused. Will be removed in Tomcat 10.1.x - */ -@Deprecated -public class ContainerThreadMarker { - -private static final ThreadLocal marker = new ThreadLocal<>(); - -public static boolean isContainerThread() { -Boolean flag = marker.get(); -if (flag == null) { -return false; -} else { -return flag.booleanValue(); -} -} - -public static void set() { -marker.set(Boolean.TRUE); -} - -public static void clear() { -marker.set(Boolean.FALSE); -} -} - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.0.x updated: Expand on fix for BZ 65757 - check for specific request thread
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 The following commit(s) were added to refs/heads/10.0.x by this push: new cb3fa12 Expand on fix for BZ 65757 - check for specific request thread cb3fa12 is described below commit cb3fa12e20f2c444cd54f7e03c19e565404d00f3 Author: Mark Thomas AuthorDate: Mon Jan 10 13:40:58 2022 + Expand on fix for BZ 65757 - check for specific request thread Previous check was for any container thread. New check looks for the specific container thread currently assigned to the request/response. --- java/org/apache/coyote/AbstractProtocol.java | 4 java/org/apache/coyote/AsyncStateMachine.java | 10 +++--- java/org/apache/coyote/ContainerThreadMarker.java | 3 +++ .../http11/upgrade/UpgradeServletInputStream.java | 5 +++-- .../http11/upgrade/UpgradeServletOutputStream.java | 5 +++-- java/org/apache/coyote/http2/StreamProcessor.java | 3 --- .../tomcat/util/net/ContainerThreadMarker.java | 3 +++ .../catalina/nonblocking/TestNonBlockingAPI.java | 23 -- webapps/docs/changelog.xml | 6 ++ 9 files changed, 46 insertions(+), 16 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index 58acf7d..ab91b37 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -805,8 +805,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, return SocketState.CLOSED; } -ContainerThreadMarker.set(); - try { if (processor == null) { String negotiatedProtocol = wrapper.getNegotiatedProtocol(); @@ -1026,8 +1024,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, // with "ERROR" level, so it will show up even on // less-than-verbose logs. getLog().error(sm.getString("abstractConnectionHandler.error"), e); -} finally { -ContainerThreadMarker.clear(); } // Make sure socket/processor is removed from the list of current diff --git a/java/org/apache/coyote/AsyncStateMachine.java b/java/org/apache/coyote/AsyncStateMachine.java index 3176246..472a48b 100644 --- a/java/org/apache/coyote/AsyncStateMachine.java +++ b/java/org/apache/coyote/AsyncStateMachine.java @@ -305,7 +305,8 @@ class AsyncStateMachine { synchronized boolean asyncComplete() { -if (!ContainerThreadMarker.isContainerThread() && +Request request = processor.getRequest(); +if ((request == null || !request.isRequestThread()) && (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP)) { updateState(AsyncState.COMPLETE_PENDING); return false; @@ -367,7 +368,8 @@ class AsyncStateMachine { synchronized boolean asyncDispatch() { -if (!ContainerThreadMarker.isContainerThread() && +Request request = processor.getRequest(); +if ((request == null || !request.isRequestThread()) && (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP)) { updateState(AsyncState.DISPATCH_PENDING); return false; @@ -436,7 +438,9 @@ class AsyncStateMachine { } else { updateState(AsyncState.ERROR); } -return !ContainerThreadMarker.isContainerThread(); + +Request request = processor.getRequest(); +return request == null || !request.isRequestThread(); } diff --git a/java/org/apache/coyote/ContainerThreadMarker.java b/java/org/apache/coyote/ContainerThreadMarker.java index 0ba2ef0..2d651b3 100644 --- a/java/org/apache/coyote/ContainerThreadMarker.java +++ b/java/org/apache/coyote/ContainerThreadMarker.java @@ -21,7 +21,10 @@ package org.apache.coyote; * data from an incoming connection. Application created threads are not * container threads and neither are threads taken from the container thread * pool to execute AsyncContext.start(Runnable). + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x */ +@Deprecated public class ContainerThreadMarker { public static boolean isContainerThread() { diff --git a/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java b/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java index b3b7fb5..63ad3f4 100644 --- a/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java +++ b/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java @@ -21,7 +21,7 @@ import java.io.IOException; import jakarta.servlet.ReadListener; import jakarta.servlet.ServletInputStream; -import org.apache.coyote.ContainerThreadMarker; +import org.apache.coyote.Reques
[tomcat] branch 9.0.x updated: Expand on fix for BZ 65757 - check for specific request thread
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 25a1da7 Expand on fix for BZ 65757 - check for specific request thread 25a1da7 is described below commit 25a1da7753cd8c438958ca27475fec62050bce3f Author: Mark Thomas AuthorDate: Mon Jan 10 13:40:58 2022 + Expand on fix for BZ 65757 - check for specific request thread Previous check was for any container thread. New check looks for the specific container thread currently assigned to the request/response. --- java/org/apache/coyote/AbstractProtocol.java | 4 java/org/apache/coyote/AsyncStateMachine.java | 10 +++--- java/org/apache/coyote/ContainerThreadMarker.java | 3 +++ .../http11/upgrade/UpgradeServletInputStream.java | 5 +++-- .../http11/upgrade/UpgradeServletOutputStream.java | 5 +++-- java/org/apache/coyote/http2/StreamProcessor.java | 3 --- .../tomcat/util/net/ContainerThreadMarker.java | 3 +++ .../catalina/nonblocking/TestNonBlockingAPI.java | 23 -- webapps/docs/changelog.xml | 6 ++ 9 files changed, 46 insertions(+), 16 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index c7042e1..949dbc5 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -828,8 +828,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, return SocketState.CLOSED; } -ContainerThreadMarker.set(); - try { if (processor == null) { String negotiatedProtocol = wrapper.getNegotiatedProtocol(); @@ -1049,8 +1047,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, // with "ERROR" level, so it will show up even on // less-than-verbose logs. getLog().error(sm.getString("abstractConnectionHandler.error"), e); -} finally { -ContainerThreadMarker.clear(); } // Make sure socket/processor is removed from the list of current diff --git a/java/org/apache/coyote/AsyncStateMachine.java b/java/org/apache/coyote/AsyncStateMachine.java index 3176246..472a48b 100644 --- a/java/org/apache/coyote/AsyncStateMachine.java +++ b/java/org/apache/coyote/AsyncStateMachine.java @@ -305,7 +305,8 @@ class AsyncStateMachine { synchronized boolean asyncComplete() { -if (!ContainerThreadMarker.isContainerThread() && +Request request = processor.getRequest(); +if ((request == null || !request.isRequestThread()) && (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP)) { updateState(AsyncState.COMPLETE_PENDING); return false; @@ -367,7 +368,8 @@ class AsyncStateMachine { synchronized boolean asyncDispatch() { -if (!ContainerThreadMarker.isContainerThread() && +Request request = processor.getRequest(); +if ((request == null || !request.isRequestThread()) && (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP)) { updateState(AsyncState.DISPATCH_PENDING); return false; @@ -436,7 +438,9 @@ class AsyncStateMachine { } else { updateState(AsyncState.ERROR); } -return !ContainerThreadMarker.isContainerThread(); + +Request request = processor.getRequest(); +return request == null || !request.isRequestThread(); } diff --git a/java/org/apache/coyote/ContainerThreadMarker.java b/java/org/apache/coyote/ContainerThreadMarker.java index 0ba2ef0..2d651b3 100644 --- a/java/org/apache/coyote/ContainerThreadMarker.java +++ b/java/org/apache/coyote/ContainerThreadMarker.java @@ -21,7 +21,10 @@ package org.apache.coyote; * data from an incoming connection. Application created threads are not * container threads and neither are threads taken from the container thread * pool to execute AsyncContext.start(Runnable). + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x */ +@Deprecated public class ContainerThreadMarker { public static boolean isContainerThread() { diff --git a/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java b/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java index 387581a..e5d4264 100644 --- a/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java +++ b/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java @@ -21,7 +21,7 @@ import java.io.IOException; import javax.servlet.ReadListener; import javax.servlet.ServletInputStream; -import org.apache.coyote.ContainerThreadMarker; +import org.apache.coyote.Request; im
[tomcat] branch 8.5.x updated: Expand on fix for BZ 65757 - check for specific request thread
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 6a49194 Expand on fix for BZ 65757 - check for specific request thread 6a49194 is described below commit 6a49194dac7dfa2edb5e3419c8ce4bb03867a580 Author: Mark Thomas AuthorDate: Mon Jan 10 13:40:58 2022 + Expand on fix for BZ 65757 - check for specific request thread Previous check was for any container thread. New check looks for the specific container thread currently assigned to the request/response. --- java/org/apache/coyote/AbstractProtocol.java | 4 java/org/apache/coyote/AsyncStateMachine.java | 10 +++--- java/org/apache/coyote/ContainerThreadMarker.java | 3 +++ .../http11/upgrade/UpgradeServletInputStream.java | 5 +++-- .../http11/upgrade/UpgradeServletOutputStream.java | 5 +++-- java/org/apache/coyote/http2/StreamProcessor.java | 3 --- .../tomcat/util/net/ContainerThreadMarker.java | 3 +++ .../catalina/nonblocking/TestNonBlockingAPI.java | 23 -- webapps/docs/changelog.xml | 6 ++ 9 files changed, 46 insertions(+), 16 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index 43f465a..4e7cfca 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -783,8 +783,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, return SocketState.CLOSED; } -ContainerThreadMarker.set(); - try { if (processor == null) { String negotiatedProtocol = wrapper.getNegotiatedProtocol(); @@ -997,8 +995,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, // with "ERROR" level, so it will show up even on // less-than-verbose logs. getLog().error(sm.getString("abstractConnectionHandler.error"), e); -} finally { -ContainerThreadMarker.clear(); } // Make sure socket/processor is removed from the list of current diff --git a/java/org/apache/coyote/AsyncStateMachine.java b/java/org/apache/coyote/AsyncStateMachine.java index c45c6b2..182fab1 100644 --- a/java/org/apache/coyote/AsyncStateMachine.java +++ b/java/org/apache/coyote/AsyncStateMachine.java @@ -305,7 +305,8 @@ public class AsyncStateMachine { public synchronized boolean asyncComplete() { -if (!ContainerThreadMarker.isContainerThread() && +Request request = processor.getRequest(); +if ((request == null || !request.isRequestThread()) && (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP)) { updateState(AsyncState.COMPLETE_PENDING); return false; @@ -367,7 +368,8 @@ public class AsyncStateMachine { public synchronized boolean asyncDispatch() { -if (!ContainerThreadMarker.isContainerThread() && +Request request = processor.getRequest(); +if ((request == null || !request.isRequestThread()) && (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP)) { updateState(AsyncState.DISPATCH_PENDING); return false; @@ -436,7 +438,9 @@ public class AsyncStateMachine { } else { updateState(AsyncState.ERROR); } -return !ContainerThreadMarker.isContainerThread(); + +Request request = processor.getRequest(); +return request == null || !request.isRequestThread(); } diff --git a/java/org/apache/coyote/ContainerThreadMarker.java b/java/org/apache/coyote/ContainerThreadMarker.java index 0ba2ef0..2d651b3 100644 --- a/java/org/apache/coyote/ContainerThreadMarker.java +++ b/java/org/apache/coyote/ContainerThreadMarker.java @@ -21,7 +21,10 @@ package org.apache.coyote; * data from an incoming connection. Application created threads are not * container threads and neither are threads taken from the container thread * pool to execute AsyncContext.start(Runnable). + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x */ +@Deprecated public class ContainerThreadMarker { public static boolean isContainerThread() { diff --git a/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java b/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java index 387581a..e5d4264 100644 --- a/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java +++ b/java/org/apache/coyote/http11/upgrade/UpgradeServletInputStream.java @@ -21,7 +21,7 @@ import java.io.IOException; import javax.servlet.ReadListener; import javax.servlet.ServletInputStream; -import org.apache.coyote.ContainerThreadMarker; +impo
Building all releases with Java 11
I thought it would be a good idea to start a new thread for this. The previous discussion started here: https://markmail.org/message/e7rsryympb2cephp I've done some testing with Tomcat 8.5.x For the Java 7 to Java 8 transition, the problematic code is ConcurrentHashMap.keySet() To test things I introduced a change to ApplicationContext that would trigger this issue on web application stop. Compile with Java 8, run with Java 7 and the logs fill with the expected stack traces on shutdown. Compile with Java 11 + release=7 and a slightly tweaked build.xml), run with Java 7 - everything works. Therefore, this basic testing confirms that release=7 does what we expected it to. A slight complication is that release=... only works with the public API. That means we would need to remove the JmxLifecycleListener since that uses classes in sun.rmi.*. This has been deprecated since December 2019 with a warning it may be removed after 2020-12-31. So, as a first step, I intend to completely remove the JMXLifecycleListener. I then want to do a little more testing to see if we can build with Java 7 or Java 11. However, my concern with that approach is that we'll also be able to build with Java 8 - the results of which would be problematic. To Remy's point, it would be useful to still be able to run the unit tests with Java 8. Assuming we can disable building with Java 8, maybe we need a special flag that enables building and testing with Java 8 but has a name like: do-not-use-for-release-builds-enable-java-8 I don't think we'll get this all sorted for this release round. We should be able to remove the JmxLifecycleListener though. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.0.x updated: Add compilation support for Graal 21.3
This is an automated email from the ASF dual-hosted git repository. fhanik pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.0.x by this push: new 916f72d Add compilation support for Graal 21.3 916f72d is described below commit 916f72d5cbf06f45260f669283852731d548d0d3 Author: Filip Hanik AuthorDate: Mon Jan 3 09:27:34 2022 -0800 Add compilation support for Graal 21.3 --- res/graal/build-tomcat-native-image.sh | 2 +- test/org/apache/catalina/startup/EmbeddedTomcat.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/res/graal/build-tomcat-native-image.sh b/res/graal/build-tomcat-native-image.sh index ec99d53..81370ee 100755 --- a/res/graal/build-tomcat-native-image.sh +++ b/res/graal/build-tomcat-native-image.sh @@ -49,7 +49,7 @@ native-image \ -H:EnableURLProtocols=http \ --report-unsupported-elements-at-runtime \ --initialize-at-run-time=org.apache,jakarta.servlet \ --H:+TraceClassInitialization \ +-H:TraceClassInitialization=org.* \ -H:+PrintClassInitialization \ -H:+PrintAnalysisCallTree \ -H:Name=tc-graal-image \ diff --git a/test/org/apache/catalina/startup/EmbeddedTomcat.java b/test/org/apache/catalina/startup/EmbeddedTomcat.java index 8b5c12c..b83f7e8 100644 --- a/test/org/apache/catalina/startup/EmbeddedTomcat.java +++ b/test/org/apache/catalina/startup/EmbeddedTomcat.java @@ -28,6 +28,7 @@ import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.apache.tomcat.util.modeler.Registry; import org.junit.Ignore; import org.apache.catalina.Context; @@ -55,6 +56,7 @@ public class EmbeddedTomcat { } public static void main(String... args) throws Exception { +Registry.disableRegistry(); Tomcat tomcat = new Tomcat(); resetLogging(); tomcat.setPort(8080); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[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 AuthorDate: Mon Jan 10 17:45:07 2022 + 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 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) + +Explicitly release ByteBuffer instances associated with pooled channels +when stopping the NioEndpoint and Nio2Endpoint. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated (629518d -> 5d64445)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 629518d Remove deprecated code new 9375932 Refactor Connector/Endpoint pause only stop new connections/requests new 5d64445 Explicitly release pooled ByteBuffer instances on endpoint stop The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: java/org/apache/coyote/AbstractProtocol.java | 6 +- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 9 ++--- java/org/apache/tomcat/util/net/NioEndpoint.java | 11 +++ webapps/docs/changelog.xml| 9 + 4 files changed, 23 insertions(+), 12 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Refactor Connector/Endpoint pause only stop new connections/requests
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 93759327a4ba74c30414c7e4f99a5eceb0253b6f Author: Mark Thomas AuthorDate: Mon Jan 10 17:22:28 2022 + Refactor Connector/Endpoint pause only stop new connections/requests --- java/org/apache/coyote/AbstractProtocol.java | 6 +- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 4 ++-- java/org/apache/tomcat/util/net/NioEndpoint.java | 6 +++--- webapps/docs/changelog.xml| 5 + 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index c286a23..896e94d 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -585,9 +585,7 @@ public abstract class AbstractProtocol implements ProtocolHandler, endpoint.start(); monitorFuture = getUtilityExecutor().scheduleWithFixedDelay( () -> { -if (!isPaused()) { -startAsyncTimeout(); -} +startAsyncTimeout(); }, 0, 60, TimeUnit.SECONDS); } @@ -630,7 +628,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, getLog().info(sm.getString("abstractProtocolHandler.pause", getName())); } -stopAsyncTimeout(); endpoint.pause(); } @@ -647,7 +644,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, } endpoint.resume(); -startAsyncTimeout(); } diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java index 47825f0..c9dc0d3 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -932,7 +932,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint } } } -if (running && !paused && eventCache != null) { +if (running && eventCache != null) { pe.reset(); eventCache.push(pe); } @@ -1195,7 +1195,7 @@ public class NioEndpoint extends AbstractJsseEndpoint if (getSocket().isOpen()) { getSocket().close(true); } -if (getEndpoint().running && !getEndpoint().paused) { +if (getEndpoint().running) { if (nioChannels == null || !nioChannels.push(getSocket())) { getSocket().free(); } @@ -1703,7 +1703,7 @@ public class NioEndpoint extends AbstractJsseEndpoint socketWrapper = null; event = null; //return to cache -if (running && !paused && processorCache != null) { +if (running && processorCache != null) { processorCache.push(this); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index a93bba0..18ee8a0 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -167,6 +167,11 @@ 65785: Perform additional validation of HTTP headers when using HTTP/2. (markt) + +When a Connector or Endpoint is paused, ensure that only new connections +and new requests on existing connections are stopped while allowing in +progress requests to run to completion. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Async timeout and paused connector/endpoint
On 06/01/2022 14:11, Rémy Maucherat wrote: Yes, this feature was about not accepting new requests, while finishing the current ones properly. So this makes sense but it needs quite a few improvements in that case. I've implemented this for 10.1.x. Looking at back-ports now. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch 10.0.x updated: Add compilation support for Graal 21.3
On 10/01/2022 17:45, fha...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. fhanik pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.0.x by this push: new 916f72d Add compilation support for Graal 21.3 916f72d is described below Why is this in 10.0.x but not 10.1.x? This also breaks the build as the import was added in the wrong place. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.0.x updated: Move import so build can complete
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 The following commit(s) were added to refs/heads/10.0.x by this push: new 99cebcd Move import so build can complete 99cebcd is described below commit 99cebcdfc0e686a84783d20f18e8ea265f8d9f02 Author: Mark Thomas AuthorDate: Mon Jan 10 17:50:07 2022 + Move import so build can complete --- test/org/apache/catalina/startup/EmbeddedTomcat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/org/apache/catalina/startup/EmbeddedTomcat.java b/test/org/apache/catalina/startup/EmbeddedTomcat.java index b83f7e8..d19496f 100644 --- a/test/org/apache/catalina/startup/EmbeddedTomcat.java +++ b/test/org/apache/catalina/startup/EmbeddedTomcat.java @@ -28,12 +28,12 @@ import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import org.apache.tomcat.util.modeler.Registry; import org.junit.Ignore; import org.apache.catalina.Context; import org.apache.catalina.connector.Connector; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.modeler.Registry; import org.apache.tomcat.util.scan.StandardJarScanFilter; import org.apache.tomcat.util.scan.StandardJarScanner; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch 10.0.x updated: Add compilation support for Graal 21.3
From: Mark Thomas Sent: Monday, January 10, 2022 9:49 AM To: dev@tomcat.apache.org Subject: Re: [tomcat] branch 10.0.x updated: Add compilation support for Graal 21.3 On 10/01/2022 17:45, fha...@apache.org wrote: > This is an automated email from the ASF dual-hosted git repository. > > fhanik pushed a commit to branch 10.0.x > in repository > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Ftomcat.git&data=04%7C01%7Cfhanik%40vmware.com%7C7ba3603eb5a84e75438908d9d461934c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637774337819926033%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=QAuAwszvuejE2s1WSBLADd9SiwXX3OTaJX56AXA%2Fejg%3D&reserved=0 > > > The following commit(s) were added to refs/heads/10.0.x by this push: > new 916f72d Add compilation support for Graal 21.3 > 916f72d is described below >Why is this in 10.0.x but not 10.1.x? Wrong branch, will fix. It will end up in 10.x and 9.x >This also breaks the build as the import was added in the wrong place. Will fix. Suprised that "ant validate" didn't catch it. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated (25a1da7 -> 338d05d)
This is an automated email from the ASF dual-hosted git repository. fhanik pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 25a1da7 Expand on fix for BZ 65757 - check for specific request thread new df26188 Add compilation support for Graal 21.3 new 338d05d Move import so build can complete The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: res/graal/build-tomcat-native-image.sh | 2 +- test/org/apache/catalina/startup/EmbeddedTomcat.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Add compilation support for Graal 21.3
This is an automated email from the ASF dual-hosted git repository. fhanik pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit df26188cc429d3b9ab1a4215dc59b95467f1a051 Author: Filip Hanik AuthorDate: Mon Jan 3 09:27:34 2022 -0800 Add compilation support for Graal 21.3 --- res/graal/build-tomcat-native-image.sh | 2 +- test/org/apache/catalina/startup/EmbeddedTomcat.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/res/graal/build-tomcat-native-image.sh b/res/graal/build-tomcat-native-image.sh index e557927..7093023 100755 --- a/res/graal/build-tomcat-native-image.sh +++ b/res/graal/build-tomcat-native-image.sh @@ -49,7 +49,7 @@ native-image \ -H:EnableURLProtocols=http \ --report-unsupported-elements-at-runtime \ --initialize-at-run-time=org.apache,javax.servlet \ --H:+TraceClassInitialization \ +-H:TraceClassInitialization=org.* \ -H:+PrintClassInitialization \ -H:+PrintAnalysisCallTree \ -H:Name=tc-graal-image \ diff --git a/test/org/apache/catalina/startup/EmbeddedTomcat.java b/test/org/apache/catalina/startup/EmbeddedTomcat.java index bf5820b..3c853df 100644 --- a/test/org/apache/catalina/startup/EmbeddedTomcat.java +++ b/test/org/apache/catalina/startup/EmbeddedTomcat.java @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.tomcat.util.modeler.Registry; import org.junit.Ignore; import org.apache.catalina.Context; @@ -57,6 +58,7 @@ public class EmbeddedTomcat { } public static void main(String... args) throws Exception { +Registry.disableRegistry(); Tomcat tomcat = new Tomcat(); resetLogging(); tomcat.setPort(8080); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: Move import so build can complete
This is an automated email from the ASF dual-hosted git repository. fhanik pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 338d05d14c14fd8eb7ca44079e016544ac374d75 Author: Mark Thomas AuthorDate: Mon Jan 10 17:50:07 2022 + Move import so build can complete --- test/org/apache/catalina/startup/EmbeddedTomcat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/org/apache/catalina/startup/EmbeddedTomcat.java b/test/org/apache/catalina/startup/EmbeddedTomcat.java index 3c853df..f8c8649 100644 --- a/test/org/apache/catalina/startup/EmbeddedTomcat.java +++ b/test/org/apache/catalina/startup/EmbeddedTomcat.java @@ -28,13 +28,13 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.tomcat.util.modeler.Registry; import org.junit.Ignore; import org.apache.catalina.Context; import org.apache.catalina.connector.Connector; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.modeler.Registry; import org.apache.tomcat.util.scan.StandardJarScanFilter; import org.apache.tomcat.util.scan.StandardJarScanner; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated (5d64445 -> 49dd3b0)
This is an automated email from the ASF dual-hosted git repository. fhanik pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 5d64445 Explicitly release pooled ByteBuffer instances on endpoint stop new 087eb42 Add compilation support for Graal 21.3 new 49dd3b0 Move import so build can complete The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: res/graal/build-tomcat-native-image.sh | 2 +- test/org/apache/catalina/startup/EmbeddedTomcat.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: Move import so build can complete
This is an automated email from the ASF dual-hosted git repository. fhanik pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 49dd3b0bceec16942c945c4ccc6433f42f7fa328 Author: Mark Thomas AuthorDate: Mon Jan 10 17:50:07 2022 + Move import so build can complete --- test/org/apache/catalina/startup/EmbeddedTomcat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/org/apache/catalina/startup/EmbeddedTomcat.java b/test/org/apache/catalina/startup/EmbeddedTomcat.java index b83f7e8..d19496f 100644 --- a/test/org/apache/catalina/startup/EmbeddedTomcat.java +++ b/test/org/apache/catalina/startup/EmbeddedTomcat.java @@ -28,12 +28,12 @@ import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import org.apache.tomcat.util.modeler.Registry; import org.junit.Ignore; import org.apache.catalina.Context; import org.apache.catalina.connector.Connector; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.modeler.Registry; import org.apache.tomcat.util.scan.StandardJarScanFilter; import org.apache.tomcat.util.scan.StandardJarScanner; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Add compilation support for Graal 21.3
This is an automated email from the ASF dual-hosted git repository. fhanik pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 087eb420a04e3c8dd80a5eb577b522451909c061 Author: Filip Hanik AuthorDate: Mon Jan 3 09:27:34 2022 -0800 Add compilation support for Graal 21.3 --- res/graal/build-tomcat-native-image.sh | 2 +- test/org/apache/catalina/startup/EmbeddedTomcat.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/res/graal/build-tomcat-native-image.sh b/res/graal/build-tomcat-native-image.sh index ec99d53..81370ee 100755 --- a/res/graal/build-tomcat-native-image.sh +++ b/res/graal/build-tomcat-native-image.sh @@ -49,7 +49,7 @@ native-image \ -H:EnableURLProtocols=http \ --report-unsupported-elements-at-runtime \ --initialize-at-run-time=org.apache,jakarta.servlet \ --H:+TraceClassInitialization \ +-H:TraceClassInitialization=org.* \ -H:+PrintClassInitialization \ -H:+PrintAnalysisCallTree \ -H:Name=tc-graal-image \ diff --git a/test/org/apache/catalina/startup/EmbeddedTomcat.java b/test/org/apache/catalina/startup/EmbeddedTomcat.java index 8b5c12c..b83f7e8 100644 --- a/test/org/apache/catalina/startup/EmbeddedTomcat.java +++ b/test/org/apache/catalina/startup/EmbeddedTomcat.java @@ -28,6 +28,7 @@ import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.apache.tomcat.util.modeler.Registry; import org.junit.Ignore; import org.apache.catalina.Context; @@ -55,6 +56,7 @@ public class EmbeddedTomcat { } public static void main(String... args) throws Exception { +Registry.disableRegistry(); Tomcat tomcat = new Tomcat(); resetLogging(); tomcat.setPort(8080); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch main updated: Refactor. Add new method isToken(String) to reduce duplication
Mark, On 1/7/22 14:46, ma...@apache.org wrote: 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 The following commit(s) were added to refs/heads/main by this push: new fe909ba Refactor. Add new method isToken(String) to reduce duplication fe909ba is described below commit fe909bad46150ffb9dcd436c0095ab97c20a2745 Author: Mark Thomas AuthorDate: Fri Jan 7 19:46:15 2022 + Refactor. Add new method isToken(String) to reduce duplication > > [snip] > diff --git a/java/org/apache/tomcat/util/http/parser/HttpParser.java b/java/org/apache/tomcat/util/http/parser/HttpParser.java index b06d468..7dcb631 100644 --- a/java/org/apache/tomcat/util/http/parser/HttpParser.java +++ b/java/org/apache/tomcat/util/http/parser/HttpParser.java @@ -237,6 +237,23 @@ public class HttpParser { } +public static boolean isToken(String s) { +// token = 1 * tchar (RFC 7230) +if (s == null) { +return false; +} +if (s.isEmpty()) { +return false; +} +for (char c : s.toCharArray()) { +if (!isToken(c)) { +return false; +} +} +return true; +} Since this is public, maybe move the reference to the RFC up into javadoc? In this case "token" has specific meaning. -chris - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Narrow the scope of the logging of invalid ccokies.
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 The following commit(s) were added to refs/heads/main by this push: new 02a1284 Narrow the scope of the logging of invalid ccokies. 02a1284 is described below commit 02a1284037e2a4c5ac1e75daf2819740edfe580a Author: Mark Thomas AuthorDate: Mon Jan 10 21:51:03 2022 + Narrow the scope of the logging of invalid ccokies. Just log the invalid cookie rather than the whole cookie header. --- java/org/apache/tomcat/util/http/parser/Cookie.java | 10 +- webapps/docs/changelog.xml | 4 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/java/org/apache/tomcat/util/http/parser/Cookie.java b/java/org/apache/tomcat/util/http/parser/Cookie.java index 9a321bf..f10d53d 100644 --- a/java/org/apache/tomcat/util/http/parser/Cookie.java +++ b/java/org/apache/tomcat/util/http/parser/Cookie.java @@ -100,6 +100,7 @@ public class Cookie { while (moreToProcess) { skipLWS(bb); +int start = bb.position(); ByteBuffer name = readToken(bb); ByteBuffer value = null; @@ -110,9 +111,9 @@ public class Cookie { skipLWS(bb); value = readCookieValueRfc6265(bb); if (value == null) { -logInvalidHeader(bb); // Invalid cookie value. Skip to the next semi-colon skipUntilSemiColon(bb); +logInvalidHeader(start, bb); continue; } skipLWS(bb); @@ -122,9 +123,9 @@ public class Cookie { if (skipResult == SkipResult.FOUND) { // NO-OP } else if (skipResult == SkipResult.NOT_FOUND) { -logInvalidHeader(bb); // Invalid cookie. Ignore it and skip to the next semi-colon skipUntilSemiColon(bb); +logInvalidHeader(start, bb); continue; } else { // SkipResult.EOF @@ -229,11 +230,10 @@ public class Cookie { } -private static void logInvalidHeader(ByteBuffer bb) { +private static void logInvalidHeader(int start, ByteBuffer bb) { UserDataHelper.Mode logMode = invalidCookieLog.getNextMode(); if (logMode != null) { -String headerValue = new String(bb.array(), bb.position(), bb.limit() - bb.position(), -StandardCharsets.UTF_8); +String headerValue = new String(bb.array(), start, bb.position() - start, StandardCharsets.UTF_8); String message = sm.getString("cookie.invalidCookieValue", headerValue); switch (logMode) { case INFO_THEN_DEBUG: diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 4c777c8..b6fb171 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -176,6 +176,10 @@ Explicitly release ByteBuffer instances associated with pooled channels when stopping the NioEndpoint and Nio2Endpoint. (markt) + +Narrow the scope of the logging of invalid cookie headers to just the +invalid cookie rather than the whole cookie header. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.0.x updated (99cebcd -> 8338aec)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 99cebcd Move import so build can complete new 15d7c94 Refactor Connector/Endpoint pause only stop new connections/requests new f98ad7a Explicitly release pooled ByteBuffer instances on endpoint stop new 8338aec Narrow the scope of the logging of invalid ccokies. The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: java/org/apache/coyote/AbstractProtocol.java | 6 + .../org/apache/tomcat/util/http/parser/Cookie.java | 31 +++--- java/org/apache/tomcat/util/net/AprEndpoint.java | 10 +-- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 9 --- java/org/apache/tomcat/util/net/NioEndpoint.java | 11 +--- webapps/docs/changelog.xml | 13 + 6 files changed, 44 insertions(+), 36 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Narrow the scope of the logging of invalid ccokies.
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 8338aec7bf62bc05b5963b0b5ce63b1794fa33af Author: Mark Thomas AuthorDate: Mon Jan 10 21:51:03 2022 + Narrow the scope of the logging of invalid ccokies. Just log the invalid cookie rather than the whole cookie header. --- .../org/apache/tomcat/util/http/parser/Cookie.java | 31 +++--- webapps/docs/changelog.xml | 4 +++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/java/org/apache/tomcat/util/http/parser/Cookie.java b/java/org/apache/tomcat/util/http/parser/Cookie.java index 24c33b2..ac8855a 100644 --- a/java/org/apache/tomcat/util/http/parser/Cookie.java +++ b/java/org/apache/tomcat/util/http/parser/Cookie.java @@ -199,6 +199,7 @@ public class Cookie { while (moreToProcess) { skipLWS(bb); +int start = bb.position(); ByteBuffer name = readToken(bb); ByteBuffer value = null; @@ -209,9 +210,9 @@ public class Cookie { skipLWS(bb); value = readCookieValueRfc6265(bb); if (value == null) { -logInvalidHeader(bb); // Invalid cookie value. Skip to the next semi-colon skipUntilSemiColon(bb); +logInvalidHeader(start, bb); continue; } skipLWS(bb); @@ -221,9 +222,9 @@ public class Cookie { if (skipResult == SkipResult.FOUND) { // NO-OP } else if (skipResult == SkipResult.NOT_FOUND) { -logInvalidHeader(bb); // Invalid cookie. Ignore it and skip to the next semi-colon skipUntilSemiColon(bb); +logInvalidHeader(start, bb); continue; } else { // SkipResult.EOF @@ -252,6 +253,7 @@ public class Cookie { skipLWS(bb); boolean parseAttributes = true; +int start = bb.position(); ByteBuffer name = readToken(bb); ByteBuffer value = null; @@ -265,7 +267,7 @@ public class Cookie { skipLWS(bb); value = readCookieValueRfc2109(bb, false); if (value == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -281,7 +283,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } @@ -292,13 +294,13 @@ public class Cookie { skipLWS(bb); skipResult = skipByte(bb, EQUALS_BYTE); if (skipResult != SkipResult.FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); path = readCookieValueRfc2109(bb, true); if (path == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -313,7 +315,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } } @@ -326,13 +328,13 @@ public class Cookie { skipLWS(bb); skipResult = skipByte(bb, EQUALS_BYTE); if (skipResult != SkipResult.FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); domain = readCookieValueRfc2109(bb, false); if (domain == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -347,7 +349,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipIn
[tomcat] 01/03: Refactor Connector/Endpoint pause only stop new connections/requests
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 15d7c946aa61263797b33adf6395f6bbb9316482 Author: Mark Thomas AuthorDate: Mon Jan 10 17:22:28 2022 + Refactor Connector/Endpoint pause only stop new connections/requests --- java/org/apache/coyote/AbstractProtocol.java | 6 +- java/org/apache/tomcat/util/net/AprEndpoint.java | 10 +- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 4 ++-- java/org/apache/tomcat/util/net/NioEndpoint.java | 6 +++--- webapps/docs/changelog.xml| 5 + 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index ab91b37..b1d9659 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -591,9 +591,7 @@ public abstract class AbstractProtocol implements ProtocolHandler, endpoint.start(); monitorFuture = getUtilityExecutor().scheduleWithFixedDelay( () -> { -if (!isPaused()) { -startAsyncTimeout(); -} +startAsyncTimeout(); }, 0, 60, TimeUnit.SECONDS); } @@ -636,7 +634,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, getLog().info(sm.getString("abstractProtocolHandler.pause", getName())); } -stopAsyncTimeout(); endpoint.pause(); } @@ -653,7 +650,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, } endpoint.resume(); -startAsyncTimeout(); } diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index e0deb55..ef6dcdf 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -1899,14 +1899,6 @@ public class AprEndpoint extends AbstractEndpoint implements SNICallB // Loop until we receive a shutdown command while (sendfileRunning) { -// Loop if endpoint is paused -while (sendfileRunning && paused) { -try { -Thread.sleep(pollTime / 1000); -} catch (InterruptedException e) { -// Ignore -} -} // Loop if poller is empty while (sendfileRunning && sendfileCount < 1 && addS.size() < 1) { // Reset maintain time. @@ -2146,7 +2138,7 @@ public class AprEndpoint extends AbstractEndpoint implements SNICallB socketWrapper = null; event = null; //return to cache -if (running && !paused && processorCache != null) { +if (running && processorCache != null) { processorCache.push(this); } } diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java index c46a3c4..8388c50 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -932,7 +932,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint } } } -if (running && !paused && eventCache != null) { +if (running && eventCache != null) { pe.reset(); eventCache.push(pe); } @@ -1218,7 +1218,7 @@ public class NioEndpoint extends AbstractJsseEndpoint if (getSocket().isOpen()) { getSocket().close(true); } -if (getEndpoint().running && !getEndpoint().paused) { +if (getEndpoint().running) { if (nioChannels == null || !nioChannels.push(getSocket())) { getSocket().free(); } @@ -1726,7 +1726,7 @@ public class NioEndpoint extends AbstractJsseEndpoint socketWrapper = null; event = null; //return to cache -if (running && !paused && processorCache != null) { +if (running && processorCache != null) { processorCache.push(this); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b33d302..14b11a1 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -158,6 +158,11 @@ 65785: Perform additional validation of HTTP headers when using HTTP/2. (markt) + +When a Connector or Endpoint is paused, ensure that only new connections +
[tomcat] 02/03: 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 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit f98ad7a84c0e760a380fc4f204788b44c835cfe1 Author: Mark Thomas AuthorDate: Mon Jan 10 17:45:07 2022 + 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 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) + +Explicitly release ByteBuffer instances associated with pooled channels +when stopping the NioEndpoint and Nio2Endpoint. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated (338d05d -> 2344a45)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 338d05d Move import so build can complete new 6f2f76d Refactor Connector/Endpoint pause only stop new connections/requests new 6f8482d Explicitly release pooled ByteBuffer instances on endpoint stop new 2344a45 Narrow the scope of the logging of invalid ccokies. The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: java/org/apache/coyote/AbstractProtocol.java | 6 + .../org/apache/tomcat/util/http/parser/Cookie.java | 31 +++--- java/org/apache/tomcat/util/net/AprEndpoint.java | 10 +-- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 9 --- java/org/apache/tomcat/util/net/NioEndpoint.java | 11 +--- webapps/docs/changelog.xml | 13 + 6 files changed, 44 insertions(+), 36 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: 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 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 6f8482d14d0fa59e40bb889aa5b0d2aa5a503660 Author: Mark Thomas AuthorDate: Mon Jan 10 17:45:07 2022 + 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 0ecac93..0f6d8a0 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -220,7 +220,10 @@ public class Nio2Endpoint extends AbstractJsseEndpoint 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 26aeced..707ec40 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) + +Explicitly release ByteBuffer instances associated with pooled channels +when stopping the NioEndpoint and Nio2Endpoint. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Narrow the scope of the logging of invalid ccokies.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 2344a45ec394f9cd9293997c003d41641fc9f44a Author: Mark Thomas AuthorDate: Mon Jan 10 21:51:03 2022 + Narrow the scope of the logging of invalid ccokies. Just log the invalid cookie rather than the whole cookie header. --- .../org/apache/tomcat/util/http/parser/Cookie.java | 31 +++--- webapps/docs/changelog.xml | 4 +++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/java/org/apache/tomcat/util/http/parser/Cookie.java b/java/org/apache/tomcat/util/http/parser/Cookie.java index 24c33b2..ac8855a 100644 --- a/java/org/apache/tomcat/util/http/parser/Cookie.java +++ b/java/org/apache/tomcat/util/http/parser/Cookie.java @@ -199,6 +199,7 @@ public class Cookie { while (moreToProcess) { skipLWS(bb); +int start = bb.position(); ByteBuffer name = readToken(bb); ByteBuffer value = null; @@ -209,9 +210,9 @@ public class Cookie { skipLWS(bb); value = readCookieValueRfc6265(bb); if (value == null) { -logInvalidHeader(bb); // Invalid cookie value. Skip to the next semi-colon skipUntilSemiColon(bb); +logInvalidHeader(start, bb); continue; } skipLWS(bb); @@ -221,9 +222,9 @@ public class Cookie { if (skipResult == SkipResult.FOUND) { // NO-OP } else if (skipResult == SkipResult.NOT_FOUND) { -logInvalidHeader(bb); // Invalid cookie. Ignore it and skip to the next semi-colon skipUntilSemiColon(bb); +logInvalidHeader(start, bb); continue; } else { // SkipResult.EOF @@ -252,6 +253,7 @@ public class Cookie { skipLWS(bb); boolean parseAttributes = true; +int start = bb.position(); ByteBuffer name = readToken(bb); ByteBuffer value = null; @@ -265,7 +267,7 @@ public class Cookie { skipLWS(bb); value = readCookieValueRfc2109(bb, false); if (value == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -281,7 +283,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } @@ -292,13 +294,13 @@ public class Cookie { skipLWS(bb); skipResult = skipByte(bb, EQUALS_BYTE); if (skipResult != SkipResult.FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); path = readCookieValueRfc2109(bb, true); if (path == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -313,7 +315,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } } @@ -326,13 +328,13 @@ public class Cookie { skipLWS(bb); skipResult = skipByte(bb, EQUALS_BYTE); if (skipResult != SkipResult.FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); domain = readCookieValueRfc2109(bb, false); if (domain == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -347,7 +349,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipInv
[tomcat] 01/03: Refactor Connector/Endpoint pause only stop new connections/requests
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 6f2f76d664c146276adebfdcf6847342ca903b08 Author: Mark Thomas AuthorDate: Mon Jan 10 17:22:28 2022 + Refactor Connector/Endpoint pause only stop new connections/requests --- java/org/apache/coyote/AbstractProtocol.java | 6 +- java/org/apache/tomcat/util/net/AprEndpoint.java | 10 +- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 4 ++-- java/org/apache/tomcat/util/net/NioEndpoint.java | 6 +++--- webapps/docs/changelog.xml| 5 + 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index 949dbc5..4f854b9 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -614,9 +614,7 @@ public abstract class AbstractProtocol implements ProtocolHandler, endpoint.start(); monitorFuture = getUtilityExecutor().scheduleWithFixedDelay( () -> { -if (!isPaused()) { -startAsyncTimeout(); -} +startAsyncTimeout(); }, 0, 60, TimeUnit.SECONDS); } @@ -659,7 +657,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, getLog().info(sm.getString("abstractProtocolHandler.pause", getName())); } -stopAsyncTimeout(); endpoint.pause(); } @@ -676,7 +673,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, } endpoint.resume(); -startAsyncTimeout(); } diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index c3d65a6..01c2b77 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -1895,14 +1895,6 @@ public class AprEndpoint extends AbstractEndpoint implements SNICallB // Loop until we receive a shutdown command while (sendfileRunning) { -// Loop if endpoint is paused -while (sendfileRunning && paused) { -try { -Thread.sleep(pollTime / 1000); -} catch (InterruptedException e) { -// Ignore -} -} // Loop if poller is empty while (sendfileRunning && sendfileCount < 1 && addS.size() < 1) { // Reset maintain time. @@ -2142,7 +2134,7 @@ public class AprEndpoint extends AbstractEndpoint implements SNICallB socketWrapper = null; event = null; //return to cache -if (running && !paused && processorCache != null) { +if (running && processorCache != null) { processorCache.push(this); } } diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java index 125261a..0ecac93 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -943,7 +943,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint } } } -if (running && !paused && eventCache != null) { +if (running && eventCache != null) { pe.reset(); eventCache.push(pe); } @@ -1245,7 +1245,7 @@ public class NioEndpoint extends AbstractJsseEndpoint if (getSocket().isOpen()) { getSocket().close(true); } -if (getEndpoint().running && !getEndpoint().paused) { +if (getEndpoint().running) { if (nioChannels == null || !nioChannels.push(getSocket())) { getSocket().free(); } @@ -1753,7 +1753,7 @@ public class NioEndpoint extends AbstractJsseEndpoint socketWrapper = null; event = null; //return to cache -if (running && !paused && processorCache != null) { +if (running && processorCache != null) { processorCache.push(this); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 004aea3..26aeced 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -158,6 +158,11 @@ 65785: Perform additional validation of HTTP headers when using HTTP/2. (markt) + +When a Connector or Endpoint is paused, ensure that only new connections +
[tomcat] branch 8.5.x updated (6a49194 -> 6492a8a)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 6a49194 Expand on fix for BZ 65757 - check for specific request thread new e1dd4ed Refactor Connector/Endpoint pause only stop new connections/requests new 6dde291 Explicitly release pooled ByteBuffer instances on endpoint stop new 6492a8a Narrow the scope of the logging of invalid cookies. The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: java/org/apache/coyote/AbstractProtocol.java | 9 --- .../org/apache/tomcat/util/http/parser/Cookie.java | 31 +++--- java/org/apache/tomcat/util/net/AprEndpoint.java | 10 +-- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 11 +--- java/org/apache/tomcat/util/net/NioEndpoint.java | 11 +--- webapps/docs/changelog.xml | 13 + 6 files changed, 44 insertions(+), 41 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: 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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 6dde29123e252a9bb89fc7286665024646b7d282 Author: Mark Thomas AuthorDate: Mon Jan 10 17:45:07 2022 + 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 8d6e3c6..6eddfd7 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -210,7 +210,10 @@ public class Nio2Endpoint extends AbstractJsseEndpoint { } } }); -nioChannels.clear(); +Nio2Channel socket; +while ((socket = nioChannels.pop()) != null) { +socket.free(); +} processorCache.clear(); } } diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 04cd5f7..0665d89 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -314,7 +314,10 @@ public class NioEndpoint extends AbstractJsseEndpoint { } shutdownExecutor(); eventCache.clear(); -nioChannels.clear(); +NioChannel socket; +while ((socket = nioChannels.pop()) != null) { +socket.free(); +} processorCache.clear(); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 39c11d4..c1d3297 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -219,6 +219,10 @@ and new requests on existing connections are stopped while allowing in progress requests to run to completion. (markt) + +Explicitly release ByteBuffer instances associated with pooled channels +when stopping the NioEndpoint and Nio2Endpoint. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Narrow the scope of the logging of invalid cookies.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 6492a8ab0023a3d962faf03b8914de3f37f9 Author: Mark Thomas AuthorDate: Mon Jan 10 21:51:03 2022 + Narrow the scope of the logging of invalid cookies. Just log the invalid cookie rather than the whole cookie header. --- .../org/apache/tomcat/util/http/parser/Cookie.java | 31 +++--- webapps/docs/changelog.xml | 4 +++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/java/org/apache/tomcat/util/http/parser/Cookie.java b/java/org/apache/tomcat/util/http/parser/Cookie.java index 17c3396..29e9d41 100644 --- a/java/org/apache/tomcat/util/http/parser/Cookie.java +++ b/java/org/apache/tomcat/util/http/parser/Cookie.java @@ -200,6 +200,7 @@ public class Cookie { while (moreToProcess) { skipLWS(bb); +int start = bb.position(); ByteBuffer name = readToken(bb); ByteBuffer value = null; @@ -210,9 +211,9 @@ public class Cookie { skipLWS(bb); value = readCookieValueRfc6265(bb); if (value == null) { -logInvalidHeader(bb); // Invalid cookie value. Skip to the next semi-colon skipUntilSemiColon(bb); +logInvalidHeader(start, bb); continue; } skipLWS(bb); @@ -222,9 +223,9 @@ public class Cookie { if (skipResult == SkipResult.FOUND) { // NO-OP } else if (skipResult == SkipResult.NOT_FOUND) { -logInvalidHeader(bb); // Invalid cookie. Ignore it and skip to the next semi-colon skipUntilSemiColon(bb); +logInvalidHeader(start, bb); continue; } else { // SkipResult.EOF @@ -253,6 +254,7 @@ public class Cookie { skipLWS(bb); boolean parseAttributes = true; +int start = bb.position(); ByteBuffer name = readToken(bb); ByteBuffer value = null; @@ -266,7 +268,7 @@ public class Cookie { skipLWS(bb); value = readCookieValueRfc2109(bb, false); if (value == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -282,7 +284,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } @@ -293,13 +295,13 @@ public class Cookie { skipLWS(bb); skipResult = skipByte(bb, EQUALS_BYTE); if (skipResult != SkipResult.FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); path = readCookieValueRfc2109(bb, true); if (path == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -314,7 +316,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } } @@ -327,13 +329,13 @@ public class Cookie { skipLWS(bb); skipResult = skipByte(bb, EQUALS_BYTE); if (skipResult != SkipResult.FOUND) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); domain = readCookieValueRfc2109(bb, false); if (domain == null) { -skipInvalidCookie(bb); +skipInvalidCookie(start, bb); continue; } skipLWS(bb); @@ -348,7 +350,7 @@ public class Cookie { parseAttributes = false; moreToProcess = false; } else if (skipResult == SkipResult.NOT_FOUND) { -skipInvalidCookie(bb); +skipInv
[tomcat] 01/03: Refactor Connector/Endpoint pause only stop new connections/requests
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit e1dd4ed5e0580ded435cbffaed455d92bf2ee1dc Author: Mark Thomas AuthorDate: Mon Jan 10 17:22:28 2022 + Refactor Connector/Endpoint pause only stop new connections/requests --- java/org/apache/coyote/AbstractProtocol.java | 9 - java/org/apache/tomcat/util/net/AprEndpoint.java | 10 +- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 6 +++--- java/org/apache/tomcat/util/net/NioEndpoint.java | 6 +++--- webapps/docs/changelog.xml| 5 + 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index 4e7cfca..d894d47 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -1214,15 +1214,6 @@ public abstract class AbstractProtocol implements ProtocolHandler, for (Processor processor : waitingProcessors) { processor.timeoutAsync(now); } - -// Loop if endpoint is paused -while (endpoint.isPaused() && asyncTimeoutRunning) { -try { -Thread.sleep(1000); -} catch (InterruptedException e) { -// Ignore -} -} } } diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 676f0b2..001f8f6 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -1964,14 +1964,6 @@ public class AprEndpoint extends AbstractEndpoint implements SNICallBack { // Loop until we receive a shutdown command while (sendfileRunning) { -// Loop if endpoint is paused -while (sendfileRunning && paused) { -try { -Thread.sleep(pollTime / 1000); -} catch (InterruptedException e) { -// Ignore -} -} // Loop if poller is empty while (sendfileRunning && sendfileCount < 1 && addS.size() < 1) { // Reset maintain time. @@ -2211,7 +2203,7 @@ public class AprEndpoint extends AbstractEndpoint implements SNICallBack { socketWrapper = null; event = null; //return to cache -if (running && !paused) { +if (running) { processorCache.push(this); } } diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java index 0093a45..8d6e3c6 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -1643,7 +1643,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint { if (state == SocketState.CLOSED) { // Close socket and pool socketWrapper.close(); -if (running && !paused) { +if (running) { if (!nioChannels.push(socketWrapper.getSocket())) { socketWrapper.getSocket().free(); } @@ -1654,7 +1654,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint { } else if (handshake == -1 ) { getHandler().process(socketWrapper, SocketEvent.CONNECT_FAIL); socketWrapper.close(); -if (running && !paused) { +if (running) { if (!nioChannels.push(socketWrapper.getSocket())) { socketWrapper.getSocket().free(); } @@ -1681,7 +1681,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint { socketWrapper = null; event = null; //return to cache -if (running && !paused) { +if (running) { processorCache.push(this); } } diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 54458aa..04cd5f7 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -589,7 +589,7 @@ public class NioEndpoint extends AbstractJsseEndpoint { if (log.isDebugEnabled()) { log.debug("Socket: [" + socket + "] closed"); } -if (running && !paused) { +if (running) {