Buildbot failure in on tomcat-11.0.x
Build status: BUILD FAILED: failed compile (failure) Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/370 Blamelist: Mark Thomas Build Text: failed compile (failure) Status Detected: new failure Build Source Stamp: [branch main] e64a7f53489f9ea57a4c8edb4d83e8c3ea4e0b94 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 compile: 1 shell_6: 0 shell_7: 0 shell_8: 0 shell_9: 0 Rsync docs to nightlies.apache.org: 0 shell_10: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 2 shell_11: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: Suppress this warning as there is no other option at present
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 a3057c8d9135b36f718163bef43d597098cb8e05 Author: Mark Thomas AuthorDate: Thu May 11 22:33:53 2023 +0100 Suppress this warning as there is no other option at present --- java/org/apache/catalina/webresources/CachedResource.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index 4338aafa10..332f74f012 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -342,6 +342,9 @@ public class CachedResource implements WebResource { try { CachedResourceURLStreamHandler handler = new CachedResourceURLStreamHandler(resourceURL, root, webAppPath, usesClassLoaderResources); +// Need the custom handler for all protocols. URL.of(...) does not allow file to use a custom handler. +// Ignore the deprecation for now. +@SuppressWarnings("deprecation") URL result = new URL(null, resourceURL.toExternalForm(), handler); handler.setCacheURL(result); return result; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: Remove support for using ^ rather than * as the separator in WAR URL
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 0119904e57e4b5f4127193e7b6ec8ff3caea3abd Author: Mark Thomas AuthorDate: Thu May 11 22:25:54 2023 +0100 Remove support for using ^ rather than * as the separator in WAR URL --- java/org/apache/tomcat/util/buf/UriUtil.java | 6 +- .../apache/catalina/webresources/war/TestHandler.java | 18 -- test/org/apache/tomcat/util/buf/TesterUriUtilBase.java | 6 -- webapps/docs/changelog.xml | 6 ++ 4 files changed, 7 insertions(+), 29 deletions(-) diff --git a/java/org/apache/tomcat/util/buf/UriUtil.java b/java/org/apache/tomcat/util/buf/UriUtil.java index 3665fdcd02..818566abae 100644 --- a/java/org/apache/tomcat/util/buf/UriUtil.java +++ b/java/org/apache/tomcat/util/buf/UriUtil.java @@ -33,7 +33,6 @@ public final class UriUtil { {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; private static final Pattern PATTERN_EXCLAMATION_MARK = Pattern.compile("!/"); -private static final Pattern PATTERN_CARET = Pattern.compile("\\^/"); private static final Pattern PATTERN_ASTERISK = Pattern.compile("\\*/"); private static final Pattern PATTERN_CUSTOM; private static final String REPLACE_CUSTOM; @@ -170,8 +169,7 @@ public final class UriUtil { // Since "!/" has a special meaning in a JAR URL, make sure that the // sequence is properly escaped if present. String tmp = PATTERN_EXCLAMATION_MARK.matcher(input).replaceAll("%21/"); -// Tomcat's custom jar:war: URL handling treats */ and ^/ as special -tmp = PATTERN_CARET.matcher(tmp).replaceAll("%5e/"); +// Tomcat's custom jar:war: URL handling treats */ as special tmp = PATTERN_ASTERISK.matcher(tmp).replaceAll("%2a/"); if (PATTERN_CUSTOM != null) { tmp = PATTERN_CUSTOM.matcher(tmp).replaceAll(REPLACE_CUSTOM); @@ -195,8 +193,6 @@ public final class UriUtil { String file = warUrl.getFile(); if (file.contains("*/")) { file = file.replaceFirst("\\*/", "!/"); -} else if (file.contains("^/")) { -file = file.replaceFirst("\\^/", "!/"); } else if (PATTERN_CUSTOM != null) { file = file.replaceFirst(PATTERN_CUSTOM.pattern(), "!/"); } diff --git a/test/org/apache/catalina/webresources/war/TestHandler.java b/test/org/apache/catalina/webresources/war/TestHandler.java index c4b72bee15..2d1e29166f 100644 --- a/test/org/apache/catalina/webresources/war/TestHandler.java +++ b/test/org/apache/catalina/webresources/war/TestHandler.java @@ -18,7 +18,6 @@ package org.apache.catalina.webresources.war; import java.io.File; import java.net.URL; -import java.net.URLConnection; import org.junit.Assert; import org.junit.Before; @@ -61,21 +60,4 @@ public class TestHandler { Assert.assertEquals(urlString, url.toExternalForm()); } - - -@Test -public void testOldFormat() throws Exception { -File f = new File("test/webresources/war-url-connection.war"); -String fileUrl = f.toURI().toURL().toString(); - -URL indexHtmlUrl = new URL("jar:war:" + fileUrl + -"^/WEB-INF/lib/test.jar!/META-INF/resources/index.html"); - -URLConnection urlConn = indexHtmlUrl.openConnection(); -urlConn.connect(); - -int size = urlConn.getContentLength(); - -Assert.assertEquals(137, size); -} } diff --git a/test/org/apache/tomcat/util/buf/TesterUriUtilBase.java b/test/org/apache/tomcat/util/buf/TesterUriUtilBase.java index 9980669aa2..febc7018ef 100644 --- a/test/org/apache/tomcat/util/buf/TesterUriUtilBase.java +++ b/test/org/apache/tomcat/util/buf/TesterUriUtilBase.java @@ -85,12 +85,6 @@ public abstract class TesterUriUtilBase { } -@Test -public void testWarToJar01() throws IOException { -doTestWarToJar("^"); -} - - @Test public void testWarToJar02() throws IOException { doTestWarToJar("*"); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 706b61b93c..f32f27e33e 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -123,6 +123,12 @@ Add RateLimitFilter which can be used to mitigate DoS and Brute Force attacks. (isapir) + +Remove support for using the ^ character to separate the +WAR file and WAR contents in Tomcat's custom WAR URL handler. The +current default separator character of * remains unchanged. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Use URI.create(...) rather than new URI(...)
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 e64a7f53489f9ea57a4c8edb4d83e8c3ea4e0b94 Author: Mark Thomas AuthorDate: Thu May 11 22:35:31 2023 +0100 Use URI.create(...) rather than new URI(...) --- test/org/apache/catalina/connector/TestRequest.java | 3 ++- test/org/apache/catalina/filters/TestRemoteIpFilter.java | 6 +++--- .../apache/catalina/nonblocking/TestNonBlockingAPI.java | 3 ++- test/org/apache/catalina/startup/TestTomcat.java | 3 ++- .../apache/catalina/startup/TestWebappServiceLoader.java | 11 ++- test/org/apache/catalina/startup/TomcatBaseTest.java | 5 +++-- .../apache/catalina/webresources/TestCachedResource.java | 2 +- .../webresources/TestClasspathUrlStreamHandler.java | 3 ++- .../apache/catalina/webresources/TestStandardRoot.java | 16 ++-- .../apache/catalina/webresources/war/TestHandler.java| 3 ++- .../catalina/webresources/war/TestWarURLConnection.java | 5 +++-- test/org/apache/jasper/servlet/TestTldScanner.java | 3 ++- test/org/apache/juli/TestClassLoaderLogManager.java | 3 ++- test/org/apache/tomcat/util/bcel/TesterPerformance.java | 3 ++- test/org/apache/tomcat/util/buf/TesterUriUtilBase.java | 3 ++- .../tomcat/util/descriptor/web/TestWebXmlOrdering.java | 4 ++-- .../tomcat/util/scan/TestAbstractInputStreamJar.java | 4 ++-- .../apache/tomcat/util/scan/TestStandardJarScanner.java | 3 ++- 18 files changed, 46 insertions(+), 37 deletions(-) diff --git a/test/org/apache/catalina/connector/TestRequest.java b/test/org/apache/catalina/connector/TestRequest.java index 54112be123..d3c4c72168 100644 --- a/test/org/apache/catalina/connector/TestRequest.java +++ b/test/org/apache/catalina/connector/TestRequest.java @@ -23,6 +23,7 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.HttpURLConnection; +import java.net.URI; import java.net.URL; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -628,7 +629,7 @@ public class TestRequest extends TomcatBaseTest { private HttpURLConnection getConnection(String query) throws IOException { URL postURL; -postURL = new URL(query); +postURL = URI.create(query).toURL(); HttpURLConnection conn = (HttpURLConnection) postURL.openConnection(); conn.setRequestMethod("POST"); diff --git a/test/org/apache/catalina/filters/TestRemoteIpFilter.java b/test/org/apache/catalina/filters/TestRemoteIpFilter.java index 8e9b2915bd..de48b98c2b 100644 --- a/test/org/apache/catalina/filters/TestRemoteIpFilter.java +++ b/test/org/apache/catalina/filters/TestRemoteIpFilter.java @@ -19,7 +19,7 @@ package org.apache.catalina.filters; import java.io.IOException; import java.io.PrintWriter; import java.net.HttpURLConnection; -import java.net.URL; +import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -761,8 +761,8 @@ public class TestRemoteIpFilter extends TomcatBaseTest { getTomcatInstance().start(); // TEST -HttpURLConnection httpURLConnection = (HttpURLConnection) new URL( -"http://localhost:; + tomcat.getConnector().getLocalPort() + "/test").openConnection(); +HttpURLConnection httpURLConnection = (HttpURLConnection) URI.create( +"http://localhost:; + tomcat.getConnector().getLocalPort() + "/test").toURL().openConnection(); String expectedRemoteAddr = "my-remote-addr"; httpURLConnection.addRequestProperty("x-forwarded-for", expectedRemoteAddr); httpURLConnection.addRequestProperty("x-forwarded-proto", "https"); diff --git a/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java b/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java index 49cd5f422c..60a96ea57c 100644 --- a/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java +++ b/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java @@ -23,6 +23,7 @@ import java.io.Serializable; import java.lang.reflect.Field; import java.net.HttpURLConnection; import java.net.Socket; +import java.net.URI; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -894,7 +895,7 @@ public class TestNonBlockingAPI extends TomcatBaseTest { public static int postUrlWithDisconnect(boolean stream, BytesStreamer streamer, String path, Map> reqHead, Map> resHead) throws IOException { -URL url = new URL(path); +URL url = URI.create(path).toURL(); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setReadTimeout(100); diff --git a/test/org/apache/catalina/startup/TestTomcat.java
[tomcat] branch main updated (cf3fb9d59b -> e64a7f5348)
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 cf3fb9d59b Fix typo. new 0119904e57 Remove support for using ^ rather than * as the separator in WAR URL new a3057c8d91 Suppress this warning as there is no other option at present new e64a7f5348 Use URI.create(...) rather than new URI(...) 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: .../catalina/webresources/CachedResource.java | 3 +++ java/org/apache/tomcat/util/buf/UriUtil.java| 6 +- test/org/apache/catalina/connector/TestRequest.java | 3 ++- .../apache/catalina/filters/TestRemoteIpFilter.java | 6 +++--- .../catalina/nonblocking/TestNonBlockingAPI.java| 3 ++- test/org/apache/catalina/startup/TestTomcat.java| 3 ++- .../catalina/startup/TestWebappServiceLoader.java | 11 ++- .../org/apache/catalina/startup/TomcatBaseTest.java | 5 +++-- .../catalina/webresources/TestCachedResource.java | 2 +- .../webresources/TestClasspathUrlStreamHandler.java | 3 ++- .../catalina/webresources/TestStandardRoot.java | 16 ++-- .../catalina/webresources/war/TestHandler.java | 21 ++--- .../webresources/war/TestWarURLConnection.java | 5 +++-- test/org/apache/jasper/servlet/TestTldScanner.java | 3 ++- test/org/apache/juli/TestClassLoaderLogManager.java | 3 ++- .../apache/tomcat/util/bcel/TesterPerformance.java | 3 ++- .../apache/tomcat/util/buf/TesterUriUtilBase.java | 9 ++--- .../util/descriptor/web/TestWebXmlOrdering.java | 4 ++-- .../util/scan/TestAbstractInputStreamJar.java | 4 ++-- .../tomcat/util/scan/TestStandardJarScanner.java| 3 ++- webapps/docs/changelog.xml | 6 ++ 21 files changed, 56 insertions(+), 66 deletions(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Fix typo.
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 cf3fb9d59b Fix typo. cf3fb9d59b is described below commit cf3fb9d59b259341e3ef54a102fbee2d9d6825c0 Author: Mark Thomas AuthorDate: Thu May 11 21:50:28 2023 +0100 Fix typo. --- java/org/apache/catalina/webresources/CachedResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java index d70d496a12..4338aafa10 100644 --- a/java/org/apache/catalina/webresources/CachedResource.java +++ b/java/org/apache/catalina/webresources/CachedResource.java @@ -327,7 +327,7 @@ public class CachedResource implements WebResource { * * One option to resolve this issue is to use a custom URL scheme for resource URLs. This would allow us, via * registration of a URLStreamHandlerFactory, to control how the resources are accessed and ensure that all - * access go via the cache We took this approach for war: URLs so we can use jar:war:file: URLs to reference + * access go via the cache. We took this approach for war: URLs so we can use jar:war:file: URLs to reference * resources in unpacked WAR files. However, because URL.setURLStreamHandlerFactory() may only be called once, * this can cause problems when using other libraries that also want to use a custom URL scheme. * - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Avoid deprecated method.
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 37b86df3c1 Avoid deprecated method. 37b86df3c1 is described below commit 37b86df3c1db83cf7a9f773531fd80bd6e054e49 Author: Mark Thomas AuthorDate: Thu May 11 20:55:36 2023 +0100 Avoid deprecated method. --- java/org/apache/catalina/ssi/SSIExec.java | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/ssi/SSIExec.java b/java/org/apache/catalina/ssi/SSIExec.java index 605f7fa6db..e85c849106 100644 --- a/java/org/apache/catalina/ssi/SSIExec.java +++ b/java/org/apache/catalina/ssi/SSIExec.java @@ -16,11 +16,11 @@ */ package org.apache.catalina.ssi; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; +import java.util.StringTokenizer; import org.apache.catalina.util.IOTools; import org.apache.tomcat.util.res.StringManager; @@ -58,7 +58,12 @@ public class SSIExec implements SSICommand { boolean foundProgram = false; try { Runtime rt = Runtime.getRuntime(); -Process proc = rt.exec(substitutedValue); +StringTokenizer st = new StringTokenizer(substitutedValue); +String[] cmdArray = new String[st.countTokens()]; +for (int i = 0; i < cmdArray.length; i++) { +cmdArray[i] = st.nextToken(); +} +Process proc = rt.exec(cmdArray); foundProgram = true; BufferedReader stdOutReader = new BufferedReader( new InputStreamReader(proc.getInputStream())); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Replace Subject.doAs() with Subject.callAs()
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 4b831e21ef Replace Subject.doAs() with Subject.callAs() 4b831e21ef is described below commit 4b831e21efdd8d9f4d6ed42b624d9f425d0c6506 Author: Mark Thomas AuthorDate: Thu May 11 20:33:36 2023 +0100 Replace Subject.doAs() with Subject.callAs() --- .../authenticator/SpnegoAuthenticator.java | 67 +- 1 file changed, 15 insertions(+), 52 deletions(-) diff --git a/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java b/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java index dab026fdac..d76edb9ecf 100644 --- a/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java +++ b/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java @@ -19,10 +19,8 @@ package org.apache.catalina.authenticator; import java.io.File; import java.io.IOException; import java.security.Principal; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; import java.util.LinkedHashMap; +import java.util.concurrent.CompletionException; import java.util.regex.Pattern; import javax.security.auth.Subject; @@ -32,7 +30,6 @@ import javax.security.auth.login.LoginException; import jakarta.servlet.http.HttpServletResponse; import org.apache.catalina.LifecycleException; -import org.apache.catalina.Realm; import org.apache.catalina.connector.Request; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -208,11 +205,16 @@ public class SpnegoAuthenticator extends AuthenticatorBase { } else { credentialLifetime = GSSCredential.DEFAULT_LIFETIME; } -final PrivilegedExceptionAction action = () -> manager.createCredential(null, -credentialLifetime, new Oid("1.3.6.1.5.5.2"), GSSCredential.ACCEPT_ONLY); -gssContext = manager.createContext(Subject.doAs(subject, action)); -outToken = Subject.doAs(lc.getSubject(), new AcceptAction(gssContext, decoded)); +gssContext = manager.createContext(Subject.callAs(subject, () -> { +return manager.createCredential(null, credentialLifetime, new Oid("1.3.6.1.5.5.2"), +GSSCredential.ACCEPT_ONLY); +})); + +final GSSContext gssContextFinal = gssContext; +outToken = Subject.callAs(subject, () -> { +return gssContextFinal.acceptSecContext(decoded, 0, decoded.length); +}); if (outToken == null) { if (log.isDebugEnabled()) { @@ -224,8 +226,9 @@ public class SpnegoAuthenticator extends AuthenticatorBase { return false; } -principal = Subject.doAs(subject, -new AuthenticateAction(context.getRealm(), gssContext, storeDelegatedCredential)); +principal = Subject.callAs(subject, () -> { +return context.getRealm().authenticate(gssContextFinal, storeDelegatedCredential); +}); } catch (GSSException e) { if (log.isDebugEnabled()) { @@ -234,7 +237,7 @@ public class SpnegoAuthenticator extends AuthenticatorBase { response.setHeader(AUTH_HEADER_NAME, AUTH_HEADER_VALUE_NEGOTIATE); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return false; -} catch (PrivilegedActionException e) { +} catch (CompletionException e) { Throwable cause = e.getCause(); if (cause instanceof GSSException) { if (log.isDebugEnabled()) { @@ -291,46 +294,6 @@ public class SpnegoAuthenticator extends AuthenticatorBase { } -/** - * This class gets a gss credential via a privileged action. - */ -public static class AcceptAction implements PrivilegedExceptionAction { - -GSSContext gssContext; - -byte[] decoded; - -public AcceptAction(GSSContext context, byte[] decodedToken) { -this.gssContext = context; -this.decoded = decodedToken; -} - -@Override -public byte[] run() throws GSSException { -return gssContext.acceptSecContext(decoded, 0, decoded.length); -} -} - - -public static class AuthenticateAction implements PrivilegedAction { - -private final Realm realm; -private final GSSContext gssContext; -private final boolean storeDelegatedCredential; - -public AuthenticateAction(Realm realm, GSSContext gssContext, boolean storeDelegatedCredential) { -this.realm = realm; -this.gssContext = gssContext; -this.storeDelegatedCredential = storeDelegatedCredential; -}
Re: [VOTE] Release Apache Tomcat 8.5.89
Mark, On Thu, May 11, 2023 at 11:23 AM Mark Thomas wrote: > On 11/05/2023 18:25, Igal Sapir wrote: > > On Thu, May 11, 2023 at 6:15 AM Mark Thomas wrote: > > > >> On 10/05/2023 22:26, Christopher Schultz wrote: > >>> On 5/10/23 17:05, Igal Sapir wrote: > >> > >> > >> > That was a specific test case. I have the following entry in > build.properties: > test.entry=org.apache.catalina.filters.TestMapperWebapps > > Confirmed with the following command: > > ❯ ant echoproperties | grep entry > [echoproperties] > >> test.entry=org.apache.catalina.filters.TestMapperWebapps > >>> > >>> Perfect. Can you try playing-around with fork="true"/"false" or some of > >>> the other debug-related settings on the thing? > >> > >> This is very strange. > >> > >> I've installed the same version of the JDK (Zulu 8.60.0.21-CA-linux64) > >> (build 1.8.0_322-b06) and the test passes on all three connectors for > me. > >> > >> The indications are that it is something specific(ish?) to your > >> environment but nothing obvious comes to mind. > >> > > > > I'm sure it's something specific to my environment, but Dimitris also > wrote > > above that he sees the same issue. In any event, I don't think that this > > should hold back the release. > > > > Setting fork="no" (I didn't know about that option - thanks Chris!) > reveals > > more information: > > > > ❯ cat > > > /workspace/build/tomcat/8.5.x/build/logs/TEST-org.apache.catalina.filters.TestMapperWebapps.NIO2.txt > > > > Testsuite: org.apache.catalina.filters.TestMapperWebapps > > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec > > > > Caused an ERROR > > org.apache.catalina.filters.TestMapperWebapps > > java.lang.ClassNotFoundException: > > org.apache.catalina.filters.TestMapperWebapps > > at java.lang.ClassLoader.loadClass(ClassLoader.java:352) > > at java.lang.Class.forName0(Native Method) > > at java.lang.Class.forName(Class.java:348) > > at org.jacoco.ant.CoverageTask.execute(CoverageTask.java:105) > > at java.util.Vector.forEach(Vector.java:1277) > > > > So the class is searched for in the wrong package? The output is looking > > in o.a.c.filters, but TestMapperWebapps is in o.a.c.mapper > > > > Maybe you can make sense out of it. > > Ah. You have code coverage enabled. Maybe that is a factor. > That's strange. Any idea where that might be coming from? I don't override the default anywhere and `ant echoproperties` shows test.coverage as false: ❯ ant echoproperties | grep test [echoproperties] test.coverage=false [echoproperties] test.exclude=org/apache/catalina/tribes/group/Test*,org/apache/catalina/tribes/group/interceptors/Test* [echoproperties] test.reports=/workspace/build/tomcat/8.5.x/build/logs [echoproperties] execute.test.apr=false [echoproperties] execute.test.nio=false [echoproperties] test.verbose=true [echoproperties] test.apr.loc=/workspace/build/tomcat/tomcat-native/tomcat-native-2.0.3/lib [echoproperties] test.name=**/Test*.java [echoproperties] test.haltonfailure=false [echoproperties] test.accesslog=false [echoproperties] test.classes=/workspace/build/tomcat/8.5.x/testclasses [echoproperties] test.openssl.path= [echoproperties] test.entry=org.apache.catalina.filters.TestMapperWebapps [echoproperties] execute.test.nio2=true [echoproperties] test.threads=6 [echoproperties] test.jvmarg.egd=-Djava.security.egd\=file\:/dev/./urandom [echoproperties] test.temp=/workspace/build/tomcat/8.5.x/test-tmp [echoproperties] test.relaxTiming=true [echoproperties] java.class.path=/opt/java/apache-ant-1.10.8/lib/ant-launcher.jar\:/opt/java/apache-ant-1.10.8/lib/ant-imageio.jar\:/o pt/java/apache-ant-1.10.8/lib/ant-jai.jar\:/opt/java/apache-ant-1.10.8/lib/ant-apache-xalan2.jar\:/opt/java/apache-ant-1.10.8/lib/ant- junit.jar\:/opt/java/apache-ant-1.10.8/lib/ant-apache-oro.jar\:/opt/java/apache-ant-1.10.8/lib/ant-launcher.jar\:/opt/java/apache-ant- 1.10.8/lib/ant-commons-net.jar\:/opt/java/apache-ant-1.10.8/lib/ant-apache-regexp.jar\:/opt/java/apache-ant-1.10.8/lib/ant- testutil.ja r\:/opt/java/apache-ant-1.10.8/lib/ant-apache-resolver.jar\:/opt/java/apache-ant-1.10.8/lib/ant-antlr.jar\:/opt/java/apache-ant-1.10.8 /lib/ant.jar\:/opt/java/apache-ant-1.10.8/lib/ant-xz.jar\:/opt/java/apache-ant-1.10.8/lib/ant-swing.jar\:/opt/java/apache-ant-1.10.8/l ib/ant-junit4.jar\:/opt/java/apache-ant-1.10.8/lib/ant-netrexx.jar\:/opt/java/apache-ant-1.10.8/lib/ant-apache-log4j.jar\:/opt/java/ap ache-ant-1.10.8/lib/ant-apache-bsf.jar\:/opt/java/apache-ant-1.10.8/lib/ant-jsch.jar\:/opt/java/apache-ant-1.10.8/lib/ant-jdepend.jar\ :/opt/java/apache-ant-1.10.8/lib/ant-junitlauncher.jar\:/opt/java/apache-ant-1.10.8/lib/ant-javamail.jar\:/opt/java/apache-ant-1.10.8/ lib/ant-jmf.jar\:/opt/java/apache-ant-1.10.8/lib/ant-commons-logging.jar\:/opt/java/apache-ant-1.10.8/lib/ant-apache-bcel.jar [echoproperties] test.basedir=/workspace/build/tomcat/8.5.x/build [echoproperties]
[tomcat] branch main updated: Suppress a couple of false positives
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 2bd20e7026 Suppress a couple of false positives 2bd20e7026 is described below commit 2bd20e702686171855d38ac362f37af00e38864a Author: Mark Thomas AuthorDate: Thu May 11 20:13:25 2023 +0100 Suppress a couple of false positives --- java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java | 1 + java/org/apache/tomcat/util/net/AbstractEndpoint.java| 1 + 2 files changed, 2 insertions(+) diff --git a/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java b/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java index fa43eebefe..77da9f4b9d 100644 --- a/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java +++ b/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java @@ -117,6 +117,7 @@ public class ThreadLocalLeakPreventionListener extends FrameworkListener { } if (executor instanceof ThreadPoolExecutor) { +@SuppressWarnings("resource") ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor; threadPoolExecutor.contextStopping(); } else if (executor instanceof StandardThreadExecutor) { diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index 5d202557c3..d33b33a17f 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -1181,6 +1181,7 @@ public abstract class AbstractEndpoint { this.executor = null; if (executor instanceof ThreadPoolExecutor) { //this is our internal one, so we need to shut it down +@SuppressWarnings("resource") ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor; tpe.shutdownNow(); long timeout = getExecutorTerminationTimeoutMillis(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Suppress a deprecation warning
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 ead83cfd53 Suppress a deprecation warning ead83cfd53 is described below commit ead83cfd538422a2eaa8edb0515930e0d573f384 Author: Mark Thomas AuthorDate: Thu May 11 20:09:21 2023 +0100 Suppress a deprecation warning --- java/org/apache/tomcat/util/Diagnostics.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java/org/apache/tomcat/util/Diagnostics.java b/java/org/apache/tomcat/util/Diagnostics.java index aa07d6a339..f9ae90b7e0 100644 --- a/java/org/apache/tomcat/util/Diagnostics.java +++ b/java/org/apache/tomcat/util/Diagnostics.java @@ -487,6 +487,7 @@ public class Diagnostics { * @param requestedSm the StringManager to use * @return the formatted JVM information text */ +@SuppressWarnings("deprecation") public static String getVMInfo(StringManager requestedSm) { StringBuilder sb = new StringBuilder(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Replace calls to Thread.getId() with Thread.threadId()
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 7b30f69370 Replace calls to Thread.getId() with Thread.threadId() 7b30f69370 is described below commit 7b30f693703dbbc5303d5a5153fd5175cca6be40 Author: Mark Thomas AuthorDate: Thu May 11 20:07:14 2023 +0100 Replace calls to Thread.getId() with Thread.threadId() --- java/org/apache/catalina/valves/StuckThreadDetectionValve.java | 10 +- java/org/apache/coyote/Request.java| 4 ++-- test/org/apache/juli/TestThreadNameCache.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java index 42b950d825..7b7ed36ca1 100644 --- a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java +++ b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java @@ -138,7 +138,7 @@ public class StuckThreadDetectionValve extends ValveBase { String msg = sm.getString("stuckThreadDetectionValve.notifyStuckThreadDetected", monitoredThread.getThread().getName(), Long.valueOf(activeTime), monitoredThread.getStartTime(), Integer.valueOf(numStuckThreads), monitoredThread.getRequestUri(), Integer.valueOf(threshold), -String.valueOf(monitoredThread.getThread().getId())); +String.valueOf(monitoredThread.getThread().threadId())); // msg += "\n" + getStackTraceAsString(trace); Throwable th = new Throwable(); th.setStackTrace(monitoredThread.getThread().getStackTrace()); @@ -174,7 +174,7 @@ public class StuckThreadDetectionValve extends ValveBase { // GC'ing, as the reference is removed from the Map in the finally clause Thread currentThread = Thread.currentThread(); -Long key = Long.valueOf(currentThread.getId()); +Long key = Long.valueOf(currentThread.threadId()); StringBuffer requestUrl = request.getRequestURL(); if (request.getQueryString() != null) { requestUrl.append('?'); @@ -234,7 +234,7 @@ public class StuckThreadDetectionValve extends ValveBase { List idList = new ArrayList<>(); for (MonitoredThread monitoredThread : activeThreads.values()) { if (monitoredThread.isMarkedAsStuck()) { -idList.add(Long.valueOf(monitoredThread.getThread().getId())); + idList.add(Long.valueOf(monitoredThread.getThread().threadId())); } } @@ -348,7 +348,7 @@ public class StuckThreadDetectionValve extends ValveBase { String msg = sm.getString("stuckThreadDetectionValve.notifyStuckThreadInterrupted", this.getThread().getName(), Long.valueOf(getActiveTimeInMillis()), this.getStartTime(), this.getRequestUri(), Long.valueOf(interruptThreadThreshold), -String.valueOf(this.getThread().getId())); +String.valueOf(this.getThread().threadId())); Throwable th = new Throwable(); th.setStackTrace(this.getThread().getStackTrace()); log.warn(msg, th); @@ -374,7 +374,7 @@ public class StuckThreadDetectionValve extends ValveBase { CompletedStuckThread(Thread thread, long totalActiveTime) { this.threadName = thread.getName(); -this.threadId = thread.getId(); +this.threadId = thread.threadId(); this.totalActiveTime = totalActiveTime; } diff --git a/java/org/apache/coyote/Request.java b/java/org/apache/coyote/Request.java index dec9be5deb..af87b4dadf 100644 --- a/java/org/apache/coyote/Request.java +++ b/java/org/apache/coyote/Request.java @@ -736,12 +736,12 @@ public final class Request { public void setRequestThread() { Thread t = Thread.currentThread(); -threadId = t.getId(); +threadId = t.threadId(); getRequestProcessor().setWorkerThreadName(t.getName()); } public boolean isRequestThread() { -return Thread.currentThread().getId() == threadId; +return Thread.currentThread().threadId() == threadId; } // Per-Request "notes" diff --git a/test/org/apache/juli/TestThreadNameCache.java b/test/org/apache/juli/TestThreadNameCache.java index 65c7a6e6b2..e67ea01f14 100644 --- a/test/org/apache/juli/TestThreadNameCache.java +++ b/test/org/apache/juli/TestThreadNameCache.java @@ -38,7 +38,7 @@ public class TestThreadNameCache { @Override public void run() { setName(THREAD_NAME); -threadId =
[tomcat] branch main updated: Update @SuppressWarnings with correct warning type
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 56400732b5 Update @SuppressWarnings with correct warning type 56400732b5 is described below commit 56400732b5c1439c224b8f6d27b5c5c6f3f3ce3b Author: Mark Thomas AuthorDate: Thu May 11 20:05:14 2023 +0100 Update @SuppressWarnings with correct warning type --- java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java index ff5d937fc4..9e5853894a 100644 --- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java +++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java @@ -368,7 +368,7 @@ public class DelegatingStatement extends AbandonedTrace implements Statement { } } -@SuppressWarnings("deprecation") // Need Commons DBCP to address this +@SuppressWarnings("removal") // Need Commons DBCP to address this @Override protected void finalize() throws Throwable { // This is required because of statement pooling. The poolable - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Don't call Thread.stop() as it now throws an Exception
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 341e818b1f Don't call Thread.stop() as it now throws an Exception 341e818b1f is described below commit 341e818b1f7fefaf1667a6730a2736d1431b99f0 Author: Mark Thomas AuthorDate: Thu May 11 20:03:16 2023 +0100 Don't call Thread.stop() as it now throws an Exception --- java/org/apache/catalina/loader/WebappClassLoaderBase.java | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java b/java/org/apache/catalina/loader/WebappClassLoaderBase.java index fede505739..d522f61618 100644 --- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java +++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java @@ -1584,7 +1584,6 @@ public abstract class WebappClassLoaderBase extends URLClassLoader } -@SuppressWarnings("deprecation") // thread.stop() private void clearReferencesThreads() { Thread[] threads = getThreads(); List threadsToStop = new ArrayList<>(); @@ -1694,11 +1693,8 @@ public abstract class WebappClassLoaderBase extends URLClassLoader count++; } if (t.isAlive()) { -// This method is deprecated and for good reason. This is -// very risky code but is the only option at this point. -// A *very* good reason for apps to do this clean-up -// themselves. -t.stop(); +// Unable to stop the thread. Log an error. +log.error(sm.getString("webappClassLoader.stopThreadFail", t.getName(), getContextName())); } } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Remove references to ThreadDeath exception
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 9efa28ae79 Remove references to ThreadDeath exception 9efa28ae79 is described below commit 9efa28ae7998a7b7279421d05326707a857ce7ee Author: Mark Thomas AuthorDate: Thu May 11 19:58:51 2023 +0100 Remove references to ThreadDeath exception It is no longer thrown by the JRE and should not be thrown by any other component. If it is thrown, it will be treated as any other Exception as it won't represent the 'death' of a thread. --- java/jakarta/el/Util.java | 3 --- java/org/apache/catalina/startup/Bootstrap.java | 3 --- java/org/apache/catalina/startup/CatalinaProperties.java| 3 --- java/org/apache/catalina/tribes/membership/McastServiceImpl.java| 3 --- java/org/apache/catalina/tribes/util/ExceptionUtils.java| 3 --- java/org/apache/el/parser/AstFunction.java | 3 --- java/org/apache/el/parser/AstValue.java | 3 --- java/org/apache/el/util/ExceptionUtils.java | 3 --- java/org/apache/jasper/runtime/ExceptionUtils.java | 3 --- java/org/apache/jasper/tagplugins/jstl/core/Set.java| 3 --- java/org/apache/naming/factory/BeanFactory.java | 3 --- java/org/apache/naming/factory/DataSourceLinkFactory.java | 3 --- java/org/apache/naming/factory/EjbFactory.java | 3 --- java/org/apache/naming/factory/FactoryBase.java | 3 --- java/org/apache/naming/factory/ResourceFactory.java | 3 --- java/org/apache/tomcat/dbcp/pool2/PoolUtils.java| 5 - java/org/apache/tomcat/dbcp/pool2/impl/SoftReferenceObjectPool.java | 2 +- java/org/apache/tomcat/jni/Library.java | 4 ++-- java/org/apache/tomcat/util/ExceptionUtils.java | 3 --- java/org/apache/tomcat/util/digester/Digester.java | 6 -- .../apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java| 3 --- .../tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java | 3 --- test/org/apache/catalina/tribes/demos/IntrospectionUtils.java | 3 --- 23 files changed, 3 insertions(+), 71 deletions(-) diff --git a/java/jakarta/el/Util.java b/java/jakarta/el/Util.java index b1fc7046d9..168f89ce42 100644 --- a/java/jakarta/el/Util.java +++ b/java/jakarta/el/Util.java @@ -47,9 +47,6 @@ class Util { * @param t the Throwable to check */ static void handleThrowable(Throwable t) { -if (t instanceof ThreadDeath) { -throw (ThreadDeath) t; -} if (t instanceof VirtualMachineError) { throw (VirtualMachineError) t; } diff --git a/java/org/apache/catalina/startup/Bootstrap.java b/java/org/apache/catalina/startup/Bootstrap.java index b0c52ef1c0..d5a6bdcd29 100644 --- a/java/org/apache/catalina/startup/Bootstrap.java +++ b/java/org/apache/catalina/startup/Bootstrap.java @@ -544,9 +544,6 @@ public final class Bootstrap { // Copied from ExceptionUtils since that class is not visible during start static void handleThrowable(Throwable t) { -if (t instanceof ThreadDeath) { -throw (ThreadDeath) t; -} if (t instanceof StackOverflowError) { // Swallow silently - it should be recoverable return; diff --git a/java/org/apache/catalina/startup/CatalinaProperties.java b/java/org/apache/catalina/startup/CatalinaProperties.java index 2bf690705b..eb144a9e77 100644 --- a/java/org/apache/catalina/startup/CatalinaProperties.java +++ b/java/org/apache/catalina/startup/CatalinaProperties.java @@ -133,9 +133,6 @@ public class CatalinaProperties { // Copied from ExceptionUtils since that class is not visible during start private static void handleThrowable(Throwable t) { -if (t instanceof ThreadDeath) { -throw (ThreadDeath) t; -} if (t instanceof VirtualMachineError) { throw (VirtualMachineError) t; } diff --git a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java index 6c6e5fe6c7..4303958ad0 100644 --- a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java +++ b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java @@ -460,9 +460,6 @@ public class McastServiceImpl extends MembershipProviderBase { msgservice.messageReceived(datum); } } catch (Throwable t1) { -if (t1 instanceof ThreadDeath) { -
Re: [VOTE] Release Apache Tomcat 8.5.89
On 11/05/2023 18:25, Igal Sapir wrote: On Thu, May 11, 2023 at 6:15 AM Mark Thomas wrote: On 10/05/2023 22:26, Christopher Schultz wrote: On 5/10/23 17:05, Igal Sapir wrote: That was a specific test case. I have the following entry in build.properties: test.entry=org.apache.catalina.filters.TestMapperWebapps Confirmed with the following command: ❯ ant echoproperties | grep entry [echoproperties] test.entry=org.apache.catalina.filters.TestMapperWebapps Perfect. Can you try playing-around with fork="true"/"false" or some of the other debug-related settings on the thing? This is very strange. I've installed the same version of the JDK (Zulu 8.60.0.21-CA-linux64) (build 1.8.0_322-b06) and the test passes on all three connectors for me. The indications are that it is something specific(ish?) to your environment but nothing obvious comes to mind. I'm sure it's something specific to my environment, but Dimitris also wrote above that he sees the same issue. In any event, I don't think that this should hold back the release. Setting fork="no" (I didn't know about that option - thanks Chris!) reveals more information: ❯ cat /workspace/build/tomcat/8.5.x/build/logs/TEST-org.apache.catalina.filters.TestMapperWebapps.NIO2.txt Testsuite: org.apache.catalina.filters.TestMapperWebapps Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec Caused an ERROR org.apache.catalina.filters.TestMapperWebapps java.lang.ClassNotFoundException: org.apache.catalina.filters.TestMapperWebapps at java.lang.ClassLoader.loadClass(ClassLoader.java:352) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.jacoco.ant.CoverageTask.execute(CoverageTask.java:105) at java.util.Vector.forEach(Vector.java:1277) So the class is searched for in the wrong package? The output is looking in o.a.c.filters, but TestMapperWebapps is in o.a.c.mapper Maybe you can make sense out of it. Ah. You have code coverage enabled. Maybe that is a factor. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat 8.5.89
On Thu, May 11, 2023 at 6:15 AM Mark Thomas wrote: > On 10/05/2023 22:26, Christopher Schultz wrote: > > On 5/10/23 17:05, Igal Sapir wrote: > > > > >> That was a specific test case. I have the following entry in > >> build.properties: > >> test.entry=org.apache.catalina.filters.TestMapperWebapps > >> > >> Confirmed with the following command: > >> > >> ❯ ant echoproperties | grep entry > >> [echoproperties] > test.entry=org.apache.catalina.filters.TestMapperWebapps > > > > Perfect. Can you try playing-around with fork="true"/"false" or some of > > the other debug-related settings on the thing? > > This is very strange. > > I've installed the same version of the JDK (Zulu 8.60.0.21-CA-linux64) > (build 1.8.0_322-b06) and the test passes on all three connectors for me. > > The indications are that it is something specific(ish?) to your > environment but nothing obvious comes to mind. > I'm sure it's something specific to my environment, but Dimitris also wrote above that he sees the same issue. In any event, I don't think that this should hold back the release. Setting fork="no" (I didn't know about that option - thanks Chris!) reveals more information: ❯ cat /workspace/build/tomcat/8.5.x/build/logs/TEST-org.apache.catalina.filters.TestMapperWebapps.NIO2.txt Testsuite: org.apache.catalina.filters.TestMapperWebapps Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec Caused an ERROR org.apache.catalina.filters.TestMapperWebapps java.lang.ClassNotFoundException: org.apache.catalina.filters.TestMapperWebapps at java.lang.ClassLoader.loadClass(ClassLoader.java:352) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.jacoco.ant.CoverageTask.execute(CoverageTask.java:105) at java.util.Vector.forEach(Vector.java:1277) So the class is searched for in the wrong package? The output is looking in o.a.c.filters, but TestMapperWebapps is in o.a.c.mapper Maybe you can make sense out of it. Best, Igal > > Mark > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >
[tomcat] branch main updated: Remove Java 11-16 specific 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 c4ffcf56a6 Remove Java 11-16 specific code c4ffcf56a6 is described below commit c4ffcf56a669aba1e508a0e769892f178879c1f5 Author: Mark Thomas AuthorDate: Thu May 11 17:58:36 2023 +0100 Remove Java 11-16 specific code --- java/org/apache/tomcat/util/net/jsse/PEMFile.java | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java b/java/org/apache/tomcat/util/net/jsse/PEMFile.java index c374e402e6..3972822398 100644 --- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java +++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java @@ -65,7 +65,6 @@ public class PEMFile { private static final byte[] OID_EC_PUBLIC_KEY = new byte[] { 0x06, 0x07, 0x2A, (byte) 0x86, 0x48, (byte) 0xCE, 0x3D, 0x02, 0x01 }; -private static final String OID_PKCS5_PBES2 = "1.2.840.113549.1.5.13"; private static final String PBES2 = "PBES2"; public static String toPEM(X509Certificate certificate) throws CertificateEncodingException { @@ -295,9 +294,8 @@ public class PEMFile { private String getPBEAlgorithm(EncryptedPrivateKeyInfo privateKeyInfo) { AlgorithmParameters parameters = privateKeyInfo.getAlgParameters(); String algName = privateKeyInfo.getAlgName(); -// Java 11 returns OID_PKCS5_PBES2 -// Java 17 returns PBES2 -if (parameters != null && (OID_PKCS5_PBES2.equals(algName) || PBES2.equals(algName))) { +// Java 17+ returns PBES2 +if (parameters != null && PBES2.equals(algName)) { /* * This should be "PBEWithAnd". * Relying on the toString() implementation is potentially - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Refactor JreCompat for minimum Java version of Java 21
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 592bc75020 Refactor JreCompat for minimum Java version of Java 21 592bc75020 is described below commit 592bc75020589df542320ae0a55cf7ff400bd45f Author: Mark Thomas AuthorDate: Thu May 11 17:09:03 2023 +0100 Refactor JreCompat for minimum Java version of Java 21 --- java/org/apache/catalina/core/StandardContext.java | 20 .../catalina/loader/WebappClassLoaderBase.java | 132 ++--- .../org/apache/tomcat/util/compat/Jre19Compat.java | 84 - java/org/apache/tomcat/util/compat/JreCompat.java | 80 + .../tomcat/util/compat/LocalStrings.properties | 16 --- .../tomcat/util/compat/LocalStrings_fr.properties | 16 --- .../tomcat/util/compat/LocalStrings_ja.properties | 16 --- .../tomcat/util/compat/LocalStrings_ko.properties | 16 --- .../util/compat/LocalStrings_zh_CN.properties | 16 --- .../servlet/http/HttpServletDoHeadBaseTest.java| 37 ++ webapps/docs/config/context.xml| 15 --- 11 files changed, 81 insertions(+), 367 deletions(-) diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 888aa53e0e..5d1cc905ad 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -705,12 +705,6 @@ public class StandardContext extends ContainerBase implements Context, Notificat */ private boolean renewThreadsWhenStoppingContext = true; -/** - * Should Tomcat attempt to clear references to classes loaded by the web application class loader from the - * ObjectStreamClass caches? - */ -private boolean clearReferencesObjectStreamClassCaches = true; - /** * Should Tomcat attempt to clear references to classes loaded by this class loader from ThreadLocals? */ @@ -2648,19 +2642,6 @@ public class StandardContext extends ContainerBase implements Context, Notificat } -public boolean getClearReferencesObjectStreamClassCaches() { -return clearReferencesObjectStreamClassCaches; -} - - -public void setClearReferencesObjectStreamClassCaches(boolean clearReferencesObjectStreamClassCaches) { -boolean oldClearReferencesObjectStreamClassCaches = this.clearReferencesObjectStreamClassCaches; -this.clearReferencesObjectStreamClassCaches = clearReferencesObjectStreamClassCaches; -support.firePropertyChange("clearReferencesObjectStreamClassCaches", oldClearReferencesObjectStreamClassCaches, -this.clearReferencesObjectStreamClassCaches); -} - - public boolean getClearReferencesThreadLocals() { return clearReferencesThreadLocals; } @@ -4745,7 +4726,6 @@ public class StandardContext extends ContainerBase implements Context, Notificat cl.setClearReferencesStopThreads(getClearReferencesStopThreads()); cl.setClearReferencesStopTimerThreads(getClearReferencesStopTimerThreads()); cl.setClearReferencesHttpClientKeepAliveThread(getClearReferencesHttpClientKeepAliveThread()); - cl.setClearReferencesObjectStreamClassCaches(getClearReferencesObjectStreamClassCaches()); cl.setClearReferencesThreadLocals(getClearReferencesThreadLocals()); cl.setSkipMemoryLeakChecksOnJvmShutdown(getSkipMemoryLeakChecksOnJvmShutdown()); } diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java b/java/org/apache/catalina/loader/WebappClassLoaderBase.java index b637fdd323..fede505739 100644 --- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java +++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java @@ -352,12 +352,6 @@ public abstract class WebappClassLoaderBase extends URLClassLoader */ private boolean clearReferencesHttpClientKeepAliveThread = true; -/** - * Should Tomcat attempt to clear references to classes loaded by this class - * loader from the ObjectStreamClass caches? - */ -private boolean clearReferencesObjectStreamClassCaches = true; - /** * Should Tomcat attempt to clear references to classes loaded by this class * loader from ThreadLocals? @@ -539,17 +533,6 @@ public abstract class WebappClassLoaderBase extends URLClassLoader } -public boolean getClearReferencesObjectStreamClassCaches() { -return clearReferencesObjectStreamClassCaches; -} - - -public void setClearReferencesObjectStreamClassCaches( -boolean clearReferencesObjectStreamClassCaches) { -this.clearReferencesObjectStreamClassCaches = clearReferencesObjectStreamClassCaches; -} - - public
[tomcat] branch main updated: Increase minimum Java version to Java 21 - aligns with Jakarta EE 11
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 dbd9fcae2c Increase minimum Java version to Java 21 - aligns with Jakarta EE 11 dbd9fcae2c is described below commit dbd9fcae2c2b336f4d05ae2a733e5935277d0088 Author: Mark Thomas AuthorDate: Thu May 11 16:40:33 2023 +0100 Increase minimum Java version to Java 21 - aligns with Jakarta EE 11 --- build.xml| 31 +++ webapps/docs/changelog.xml | 7 +++ webapps/docs/tomcat-docs.xsl | 4 ++-- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/build.xml b/build.xml index a919258b03..ab0021e3e2 100644 --- a/build.xml +++ b/build.xml @@ -105,9 +105,9 @@ - - - + + + @@ -1969,21 +1969,13 @@ - - - - - - - - + + + - - - - - - + + + @@ -2022,9 +2014,8 @@ - - - + + diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 96421d021a..706b61b93c 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -105,6 +105,13 @@ issues do not "pop up" wrt. others). --> + + + +Increase the minimum supported Java version to Java 21. (markt) + + + diff --git a/webapps/docs/tomcat-docs.xsl b/webapps/docs/tomcat-docs.xsl index ec905cbe8e..f927e4fc4a 100644 --- a/webapps/docs/tomcat-docs.xsl +++ b/webapps/docs/tomcat-docs.xsl @@ -39,8 +39,8 @@ - - + + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Try not using multiple values in exclude
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 029bb096ab Try not using multiple values in exclude 029bb096ab is described below commit 029bb096abc0a7082ecaa378d9f185a9bf6f1606 Author: Mark Thomas AuthorDate: Thu May 11 15:44:21 2023 +0100 Try not using multiple values in exclude --- .github/workflows/ci.yml | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05558d6912..182bda7660 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,9 +37,13 @@ jobs: os: [ ubuntu-latest, windows-latest ] exclude: - isMain: true -java: [ 17, 20 ] +java: 17 + - isMain: true +java: 20 + - os: windows-latest +java: 20 - os: windows-latest -java: [ 20, 21-ea ] +java: 21-ea name: JDK${{ matrix.java }} ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Another attempt to configure test matrix
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 9766d5d834 Another attempt to configure test matrix 9766d5d834 is described below commit 9766d5d8345b9234da3e02295a802d1b6570a4fb Author: Mark Thomas AuthorDate: Thu May 11 15:42:01 2023 +0100 Another attempt to configure test matrix --- .github/workflows/ci.yml | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b32153efe3..05558d6912 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,13 +34,12 @@ jobs: isMain: - ${{ contains(github.ref, 'main') }} java: [ 17, 20, 21-ea ] -os: [ ubuntu-latest ] -include: -- os: windows-latest - java: 17 +os: [ ubuntu-latest, windows-latest ] exclude: - isMain: true java: [ 17, 20 ] + - os: windows-latest +java: [ 20, 21-ea ] name: JDK${{ matrix.java }} ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Fix syntax
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 c740143926 Fix syntax c740143926 is described below commit c7401439267293f832400a420a6a9d561669d6e3 Author: Mark Thomas AuthorDate: Thu May 11 15:40:01 2023 +0100 Fix syntax --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2392f5b503..b32153efe3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: java: 17 exclude: - isMain: true -java: 17, 20 +java: [ 17, 20 ] name: JDK${{ matrix.java }} ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Doh. Fix logic.
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 76c11c0191 Doh. Fix logic. 76c11c0191 is described below commit 76c11c0191fe60a65d49bb93c4d323de81220093 Author: Mark Thomas AuthorDate: Thu May 11 15:38:47 2023 +0100 Doh. Fix logic. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 588e0d8344..2392f5b503 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: - os: windows-latest java: 17 exclude: - - isMain: false + - isMain: true java: 17, 20 name: JDK${{ matrix.java }} ${{ matrix.os }} runs-on: ${{ matrix.os }} - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Update GitHub actions
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 0e16e831e4 Update GitHub actions 0e16e831e4 is described below commit 0e16e831e49b41b2087500119053be3381251811 Author: Mark Thomas AuthorDate: Thu May 11 15:31:34 2023 +0100 Update GitHub actions Update Java versions to - latest LTS - latest release - latest EA Limit main to running on latest EA (Java 21) as it will shortly be updated to require that version --- .github/workflows/ci.yml | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 718d2c9c53..588e0d8344 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,11 +31,16 @@ jobs: strategy: fail-fast: false matrix: -java: [ 17, 19, 20-ea ] +isMain: + - ${{ contains(github.ref, 'main') }} +java: [ 17, 20, 21-ea ] os: [ ubuntu-latest ] include: - os: windows-latest java: 17 +exclude: + - isMain: false +java: 17, 20 name: JDK${{ matrix.java }} ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat 8.5.89
On 10/05/2023 22:26, Christopher Schultz wrote: On 5/10/23 17:05, Igal Sapir wrote: That was a specific test case. I have the following entry in build.properties: test.entry=org.apache.catalina.filters.TestMapperWebapps Confirmed with the following command: ❯ ant echoproperties | grep entry [echoproperties] test.entry=org.apache.catalina.filters.TestMapperWebapps Perfect. Can you try playing-around with fork="true"/"false" or some of the other debug-related settings on the thing? This is very strange. I've installed the same version of the JDK (Zulu 8.60.0.21-CA-linux64) (build 1.8.0_322-b06) and the test passes on all three connectors for me. The indications are that it is something specific(ish?) to your environment but nothing obvious comes to mind. 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: Use the container executor if available
This is an automated email from the ASF dual-hosted git repository. remm 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 253641c728 Use the container executor if available 253641c728 is described below commit 253641c7287ee1f906bad562836931413083a440 Author: remm AuthorDate: Thu May 11 10:15:28 2023 +0200 Use the container executor if available As promised in the PR. --- .../apache/catalina/filters/RateLimitFilter.java | 9 ++- .../apache/catalina/util/LocalStrings.properties | 2 + .../apache/catalina/util/TimeBucketCounter.java| 89 ++ .../catalina/util/TestTimeBucketCounter.java | 4 +- 4 files changed, 68 insertions(+), 36 deletions(-) diff --git a/java/org/apache/catalina/filters/RateLimitFilter.java b/java/org/apache/catalina/filters/RateLimitFilter.java index d164eee94e..887a551273 100644 --- a/java/org/apache/catalina/filters/RateLimitFilter.java +++ b/java/org/apache/catalina/filters/RateLimitFilter.java @@ -18,6 +18,7 @@ package org.apache.catalina.filters; import java.io.IOException; +import java.util.concurrent.ScheduledExecutorService; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; @@ -31,6 +32,7 @@ import org.apache.catalina.util.TimeBucketCounter; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.res.StringManager; +import org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor; /** * @@ -191,7 +193,12 @@ public class RateLimitFilter extends GenericFilter { statusMessage = param; } -bucketCounter = new TimeBucketCounter(bucketDuration); +ScheduledExecutorService executorService = +(ScheduledExecutorService) getServletContext().getAttribute(ScheduledThreadPoolExecutor.class.getName()); +if (executorService == null) { +executorService = new java.util.concurrent.ScheduledThreadPoolExecutor(1); +} +bucketCounter = new TimeBucketCounter(bucketDuration, executorService); actualRequests = (int) Math.round(bucketCounter.getRatio() * bucketRequests); diff --git a/java/org/apache/catalina/util/LocalStrings.properties b/java/org/apache/catalina/util/LocalStrings.properties index fe0e7875ce..d1d5bcffab 100644 --- a/java/org/apache/catalina/util/LocalStrings.properties +++ b/java/org/apache/catalina/util/LocalStrings.properties @@ -53,3 +53,5 @@ sessionIdGeneratorBase.noSHA1PRNG=The default SHA1PRNG algorithm for SecureRando sessionIdGeneratorBase.random=Exception initializing random number generator of class [{0}]. Falling back to java.secure.SecureRandom sessionIdGeneratorBase.randomAlgorithm=Exception initializing random number generator using algorithm [{0}] sessionIdGeneratorBase.randomProvider=Exception initializing random number generator using provider [{0}] + +timebucket.maintenance.error=Error processing periodic maintenance diff --git a/java/org/apache/catalina/util/TimeBucketCounter.java b/java/org/apache/catalina/util/TimeBucketCounter.java index 9a472523c7..e106e24e76 100644 --- a/java/org/apache/catalina/util/TimeBucketCounter.java +++ b/java/org/apache/catalina/util/TimeBucketCounter.java @@ -18,8 +18,16 @@ package org.apache.catalina.util; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.res.StringManager; + /** * This class maintains a thread safe hash map that has timestamp-based buckets followed by a string for a key, and a * counter for a value. each time the increment() method is called it adds the key if it does not exist, increments its @@ -27,6 +35,9 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class TimeBucketCounter { +private static final Log log = LogFactory.getLog(TimeBucketCounter.class); +private static final StringManager sm = StringManager.getManager(TimeBucketCounter.class); + /** * Map to hold the buckets */ @@ -43,16 +54,22 @@ public class TimeBucketCounter { private final double ratio; /** - * Flag for the maintenance thread + * The future allowing control of the background processor. */ -volatile boolean isRunning = false; +private ScheduledFuture maintenanceFuture; +private ScheduledFuture monitorFuture; +private final ScheduledExecutorService executorService; +private final long sleeptime; /** * Creates a new TimeBucketCounter with the specified lifetime. * * @param bucketDuration duration in
[tomcat] branch 10.1.x updated: Use the container executor if available
This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 5917d7db2c Use the container executor if available 5917d7db2c is described below commit 5917d7db2caefb0946068a0a67c5ed7d263e2f5d Author: remm AuthorDate: Thu May 11 10:15:28 2023 +0200 Use the container executor if available As promised in the PR. --- .../apache/catalina/filters/RateLimitFilter.java | 9 ++- .../apache/catalina/util/LocalStrings.properties | 2 + .../apache/catalina/util/TimeBucketCounter.java| 89 ++ .../catalina/util/TestTimeBucketCounter.java | 4 +- 4 files changed, 68 insertions(+), 36 deletions(-) diff --git a/java/org/apache/catalina/filters/RateLimitFilter.java b/java/org/apache/catalina/filters/RateLimitFilter.java index 097485aef3..8172fb1ae1 100644 --- a/java/org/apache/catalina/filters/RateLimitFilter.java +++ b/java/org/apache/catalina/filters/RateLimitFilter.java @@ -18,6 +18,7 @@ package org.apache.catalina.filters; import java.io.IOException; +import java.util.concurrent.ScheduledExecutorService; import jakarta.servlet.FilterChain; import jakarta.servlet.FilterConfig; @@ -31,6 +32,7 @@ import org.apache.catalina.util.TimeBucketCounter; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.res.StringManager; +import org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor; /** * @@ -191,7 +193,12 @@ public class RateLimitFilter extends GenericFilter { statusMessage = param; } -bucketCounter = new TimeBucketCounter(bucketDuration); +ScheduledExecutorService executorService = +(ScheduledExecutorService) getServletContext().getAttribute(ScheduledThreadPoolExecutor.class.getName()); +if (executorService == null) { +executorService = new java.util.concurrent.ScheduledThreadPoolExecutor(1); +} +bucketCounter = new TimeBucketCounter(bucketDuration, executorService); actualRequests = (int) Math.round(bucketCounter.getRatio() * bucketRequests); diff --git a/java/org/apache/catalina/util/LocalStrings.properties b/java/org/apache/catalina/util/LocalStrings.properties index 7b8dda0ea0..e7a3343d44 100644 --- a/java/org/apache/catalina/util/LocalStrings.properties +++ b/java/org/apache/catalina/util/LocalStrings.properties @@ -48,3 +48,5 @@ sessionIdGeneratorBase.noSHA1PRNG=The default SHA1PRNG algorithm for SecureRando sessionIdGeneratorBase.random=Exception initializing random number generator of class [{0}]. Falling back to java.secure.SecureRandom sessionIdGeneratorBase.randomAlgorithm=Exception initializing random number generator using algorithm [{0}] sessionIdGeneratorBase.randomProvider=Exception initializing random number generator using provider [{0}] + +timebucket.maintenance.error=Error processing periodic maintenance diff --git a/java/org/apache/catalina/util/TimeBucketCounter.java b/java/org/apache/catalina/util/TimeBucketCounter.java index 9a472523c7..e106e24e76 100644 --- a/java/org/apache/catalina/util/TimeBucketCounter.java +++ b/java/org/apache/catalina/util/TimeBucketCounter.java @@ -18,8 +18,16 @@ package org.apache.catalina.util; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.res.StringManager; + /** * This class maintains a thread safe hash map that has timestamp-based buckets followed by a string for a key, and a * counter for a value. each time the increment() method is called it adds the key if it does not exist, increments its @@ -27,6 +35,9 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class TimeBucketCounter { +private static final Log log = LogFactory.getLog(TimeBucketCounter.class); +private static final StringManager sm = StringManager.getManager(TimeBucketCounter.class); + /** * Map to hold the buckets */ @@ -43,16 +54,22 @@ public class TimeBucketCounter { private final double ratio; /** - * Flag for the maintenance thread + * The future allowing control of the background processor. */ -volatile boolean isRunning = false; +private ScheduledFuture maintenanceFuture; +private ScheduledFuture monitorFuture; +private final ScheduledExecutorService executorService; +private final long sleeptime; /** * Creates a new TimeBucketCounter with the specified lifetime. * * @param bucketDuration duration in
[tomcat] branch main updated: Use the container executor if available
This is an automated email from the ASF dual-hosted git repository. remm 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 c0fff033a4 Use the container executor if available c0fff033a4 is described below commit c0fff033a4a89f5c4b8690cd5ef6ab7a30819c48 Author: remm AuthorDate: Thu May 11 10:15:28 2023 +0200 Use the container executor if available As promised in the PR. --- .../apache/catalina/filters/RateLimitFilter.java | 9 ++- .../apache/catalina/util/LocalStrings.properties | 2 + .../apache/catalina/util/TimeBucketCounter.java| 89 ++ .../catalina/util/TestTimeBucketCounter.java | 4 +- 4 files changed, 68 insertions(+), 36 deletions(-) diff --git a/java/org/apache/catalina/filters/RateLimitFilter.java b/java/org/apache/catalina/filters/RateLimitFilter.java index 097485aef3..8172fb1ae1 100644 --- a/java/org/apache/catalina/filters/RateLimitFilter.java +++ b/java/org/apache/catalina/filters/RateLimitFilter.java @@ -18,6 +18,7 @@ package org.apache.catalina.filters; import java.io.IOException; +import java.util.concurrent.ScheduledExecutorService; import jakarta.servlet.FilterChain; import jakarta.servlet.FilterConfig; @@ -31,6 +32,7 @@ import org.apache.catalina.util.TimeBucketCounter; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.res.StringManager; +import org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor; /** * @@ -191,7 +193,12 @@ public class RateLimitFilter extends GenericFilter { statusMessage = param; } -bucketCounter = new TimeBucketCounter(bucketDuration); +ScheduledExecutorService executorService = +(ScheduledExecutorService) getServletContext().getAttribute(ScheduledThreadPoolExecutor.class.getName()); +if (executorService == null) { +executorService = new java.util.concurrent.ScheduledThreadPoolExecutor(1); +} +bucketCounter = new TimeBucketCounter(bucketDuration, executorService); actualRequests = (int) Math.round(bucketCounter.getRatio() * bucketRequests); diff --git a/java/org/apache/catalina/util/LocalStrings.properties b/java/org/apache/catalina/util/LocalStrings.properties index 7b8dda0ea0..e7a3343d44 100644 --- a/java/org/apache/catalina/util/LocalStrings.properties +++ b/java/org/apache/catalina/util/LocalStrings.properties @@ -48,3 +48,5 @@ sessionIdGeneratorBase.noSHA1PRNG=The default SHA1PRNG algorithm for SecureRando sessionIdGeneratorBase.random=Exception initializing random number generator of class [{0}]. Falling back to java.secure.SecureRandom sessionIdGeneratorBase.randomAlgorithm=Exception initializing random number generator using algorithm [{0}] sessionIdGeneratorBase.randomProvider=Exception initializing random number generator using provider [{0}] + +timebucket.maintenance.error=Error processing periodic maintenance diff --git a/java/org/apache/catalina/util/TimeBucketCounter.java b/java/org/apache/catalina/util/TimeBucketCounter.java index 9a472523c7..e106e24e76 100644 --- a/java/org/apache/catalina/util/TimeBucketCounter.java +++ b/java/org/apache/catalina/util/TimeBucketCounter.java @@ -18,8 +18,16 @@ package org.apache.catalina.util; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.res.StringManager; + /** * This class maintains a thread safe hash map that has timestamp-based buckets followed by a string for a key, and a * counter for a value. each time the increment() method is called it adds the key if it does not exist, increments its @@ -27,6 +35,9 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class TimeBucketCounter { +private static final Log log = LogFactory.getLog(TimeBucketCounter.class); +private static final StringManager sm = StringManager.getManager(TimeBucketCounter.class); + /** * Map to hold the buckets */ @@ -43,16 +54,22 @@ public class TimeBucketCounter { private final double ratio; /** - * Flag for the maintenance thread + * The future allowing control of the background processor. */ -volatile boolean isRunning = false; +private ScheduledFuture maintenanceFuture; +private ScheduledFuture monitorFuture; +private final ScheduledExecutorService executorService; +private final long sleeptime; /** * Creates a new TimeBucketCounter with the specified lifetime. * * @param bucketDuration duration in
[GitHub] [tomcat] kang-hl opened a new pull request, #615: Add a reset method to release reference
kang-hl opened a new pull request, #615: URL: https://github.com/apache/tomcat/pull/615 (no comment) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated: Update IDE configs
This is an automated email from the ASF dual-hosted git repository. lihan 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 d86253f2f2 Update IDE configs d86253f2f2 is described below commit d86253f2f2a07aa3c7cb388c1bf12db1fe92cc74 Author: lihan AuthorDate: Thu May 11 14:59:22 2023 +0800 Update IDE configs --- res/ide-support/eclipse/eclipse.classpath | 1 - res/ide-support/idea/tomcat.iml | 2 +- res/ide-support/netbeans/project.xml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/res/ide-support/eclipse/eclipse.classpath b/res/ide-support/eclipse/eclipse.classpath index 881f58847e..de3d205f3a 100644 --- a/res/ide-support/eclipse/eclipse.classpath +++ b/res/ide-support/eclipse/eclipse.classpath @@ -29,7 +29,6 @@ - diff --git a/res/ide-support/idea/tomcat.iml b/res/ide-support/idea/tomcat.iml index 4d83e65156..904c85171c 100644 --- a/res/ide-support/idea/tomcat.iml +++ b/res/ide-support/idea/tomcat.iml @@ -113,7 +113,7 @@ - + diff --git a/res/ide-support/netbeans/project.xml b/res/ide-support/netbeans/project.xml index fea783cd6e..05c25d860f 100644 --- a/res/ide-support/netbeans/project.xml +++ b/res/ide-support/netbeans/project.xml @@ -178,7 +178,7 @@ --> java -@JAXRPC_JAR@:@WSDL4J_JAR@:@JDT_JAR@:@BND_JAR@:@MIGRATION_JAR@:${ant.includes}/ +@JAXRPC_JAR@:@WSDL4J_JAR@:@JDT_JAR@:${ant.includes}/ @BUILD_JAVA_VERSION@ - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat 10.1.9
> On May 10, 2023, at 00:12, Christopher Schultz > wrote: > > The proposed Apache Tomcat 10.1.9 release is now available for > voting. > > The notable changes compared to 10.1.8 are: > > - Many improvements to the JSON access log valve. > > - Deprecate support for the HTTP Connector settings rejectIllegalHeader > and allowHostHeaderMismatch and reject HTTP headers without names. > > - Add a RateLimitFilter which can be used to mitigate DoS and Brute > Force attacks. > > For full details, see the change log: > https://nightlies.apache.org/tomcat/tomcat-10.1.x/docs/changelog.html > > Applications that run on Tomcat 9 and earlier will not run on Tomcat 10 > without changes. Java EE applications designed for Tomcat 9 and earlier may > be placed in the $CATALINA_BASE/webapps-javaee directory and Tomcat will > automatically convert them to Jakarta EE and copy them to the webapps > directory. > > It can be obtained from: > https://dist.apache.org/repos/dist/dev/tomcat/tomcat-10/v10.1.9/ > > The Maven staging repo is: > https://repository.apache.org/content/repositories/orgapachetomcat-1435 > > The tag is: > https://github.com/apache/tomcat/tree/10.1.9 > 5d45c1a9359c2298d7140c1ca90cb8c43809a168 > > The proposed 10.1.9 release is: > [ ] Broken - do not release > [X ] Stable - go ahead and release as 10.1.9 Han > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org