Re: [tomcat] branch 10.1.x updated: Disable test for Java 16 onwards since performance is comparable
Any plans to backport this for TC 9? JreCompat seems to provide isJre16Available() for TC 9, so backport should work. I can confirm I still see the failures for 9.0.71, but only for Java 17 and 21 (most of the runs with Java 17 but not every run; Java 16 not tested, no failures for 8 and 11). TC 8.5 does not have isJre16Available(), so backporting there would be a bit bigger. Thanks and regards, Rainer Am 14.11.22 um 12:43 schrieb ma...@apache.org: This is an automated email from the ASF dual-hosted git repository. markt 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 1058eed2b6 Disable test for Java 16 onwards since performance is comparable 1058eed2b6 is described below commit 1058eed2b6e94f09b8f3ecdcac3be634baa01f76 Author: Mark Thomas AuthorDate: Mon Nov 14 11:42:53 2022 + Disable test for Java 16 onwards since performance is comparable --- test/org/apache/tomcat/util/buf/TestMessageBytes.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/org/apache/tomcat/util/buf/TestMessageBytes.java b/test/org/apache/tomcat/util/buf/TestMessageBytes.java index 3311996394..4abc1b6374 100644 --- a/test/org/apache/tomcat/util/buf/TestMessageBytes.java +++ b/test/org/apache/tomcat/util/buf/TestMessageBytes.java @@ -23,8 +23,11 @@ import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; import org.junit.Assert; +import org.junit.Assume; import org.junit.Test; +import org.apache.tomcat.util.compat.JreCompat; + public class TestMessageBytes { private static final String CONVERSION_STRING = @@ -100,6 +103,10 @@ public class TestMessageBytes { */ @Test public void testConversionPerformance() { + +// ISO_8859_1 conversion appears to be optimised in Java 16 onwards +Assume.assumeFalse(JreCompat.isJre16Available()); + long optimized = -1; long nonOptimized = -1; @@ -110,7 +117,7 @@ public class TestMessageBytes { * once to run the test and once more in case of unexpected CI /GC * slowness. The test will exit early if possible. * - * MeesageBytes only optimises conversion for ISO_8859_1 + * MessageBytes only optimises conversion for ISO_8859_1 */ for (int i = 0; i < 3; i++) { optimized = doTestOptimisedConversionPerformance(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
TC 8.5.85 TestSsl.testPost() fails for Java 1.7.0 with OpenSSL 3.1.0beta1
It is probably not the most common combination, but when running TC 8.5.85 unit tests with Java 1.7.0 plus tcnative 2.0.2 build against OpenSSL 3.1.0beta1, the test testPost() fails all 8 iterations it uses with: javax.net.ssl.SSLException: ciphertext sanity check failed at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1904) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:981) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:891) at sun.security.ssl.AppInputStream.read(AppInputStream.java:102) at sun.security.ssl.AppInputStream.read(AppInputStream.java:69) at org.apache.tomcat.util.net.TestSsl$1.run(TestSsl.java:131) Caused by: javax.crypto.BadPaddingException: ciphertext sanity check failed at sun.security.ssl.InputRecord.decrypt(InputRecord.java:147) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:976) ... 4 more I guess this is nothing to fix for us, just wanted to mention it in case someones searches for it. The test does not fail with other OpenSSL versions like 3.0.7 and also not with higher Java versions, just that combination. But this combination does fail consistently on all 6 Linux platforms plus Solaris. Apart from that testing with OpenSSL 3.1.0beta1 looks pretty good. Best regards, Rainer - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat 11.0.0-M2
On Fri, Jan 13, 2023 at 2:48 PM Mark Thomas wrote: > > Ping. This vote is current one PMV vote short of being bale to release. +1 but TBH at this stage it's not super useful to actually do a release, a git tag is just as good. Rémy > > Mark > > > On 09/01/2023 18:20, Mark Thomas wrote: > > The proposed Apache Tomcat 11.0.0-M2 release is now available for > > voting. > > > > Apache Tomcat 11.0.0-M2 is a milestone release of the 11.0.x branch and > > has been made to provide users with early access to the new features in > > Apache Tomcat 11.0.x so that they may provide feedback. The notable > > changes compared to the previous milestone include: > > > > - Add ByteBuffer support to ServletInputStream and ServletOutputStream > > > > - Update Cookie parsing and handling to treat the quotes in a quoted > >cookie value as part of the value as required by RFC 6265 and > >explicitly clarified in RFC 6265bis. > > > > - When resetting an HTTP/2 stream because the final response has been > >generated before the request has been fully read, use the HTTP/2 error > >code NO_ERROR so that client does not discard the response. Based on a > >suggestion by Lorenzo Dalla Vecchia. > > > > For full details, see the change log: > > https://nightlies.apache.org/tomcat/tomcat-11.0.x/docs/changelog.html > > > > Applications that run on Tomcat 9 and earlier will not run on Tomcat 11 > > 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. Applications using deprecated APIs may require > > further changes. > > > > It can be obtained from: > > https://dist.apache.org/repos/dist/dev/tomcat/tomcat-11/v11.0.0-M2/ > > 4b03c23ad60e678c1d1a85df815fb6cd8d14ca67 > > > > The Maven staging repo is: > > https://repository.apache.org/content/repositories/orgapachetomcat-1413 > > > > The tag is: > > https://github.com/apache/tomcat/tree/11.0.0-M2 > > > > > > The proposed 11.0.0-M2 release is: > > [ ] Broken - do not release > > [ ] Stable - go ahead and release as 11.0.0-M2 > > > > - > > 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 > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch main updated: Update comments. Hashtable usage was replaced with Map
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 b18ba2f3c1 Update comments. Hashtable usage was replaced with Map b18ba2f3c1 is described below commit b18ba2f3c1e00638a1dded1cde03072f9609cca1 Author: Mark Thomas AuthorDate: Mon Jan 16 17:21:51 2023 + Update comments. Hashtable usage was replaced with Map --- java/org/apache/catalina/servlets/CGIServlet.java| 10 +- java/org/apache/catalina/servlets/WebdavServlet.java | 2 +- java/org/apache/jasper/compiler/Generator.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/java/org/apache/catalina/servlets/CGIServlet.java b/java/org/apache/catalina/servlets/CGIServlet.java index c2309e8e58..d0755c6fdd 100644 --- a/java/org/apache/catalina/servlets/CGIServlet.java +++ b/java/org/apache/catalina/servlets/CGIServlet.java @@ -1444,7 +1444,7 @@ public final class CGIServlet extends HttpServlet { * respectively. * * @param command string full path to command to be executed - * @param env Hashtable with the desired script environment + * @param env Map with the desired script environment * @param wd File with the script's desired working directory * @param params ArrayList with the script's query command line * parameters as strings @@ -1508,11 +1508,11 @@ public final class CGIServlet extends HttpServlet { /** - * Converts a Hashtable to a String array by converting each - * key/value pair in the Hashtable to a String in the form - * "key=value" (hashkey + "=" + hash.get(hashkey).toString()) + * Converts a Map to a String array by converting each + * key/value pair in the Map to a String in the form + * "key=value" (key + "=" + map.get(key).toString()) * - * @param map Hashtable to convert + * @param map Map to convert * * @return converted string array * diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index f0c88f7d8d..36bf46a269 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -1576,7 +1576,7 @@ public class WebdavServlet extends DefaultServlet { /** * Copy a collection. * - * @param errorList Hashtable containing the list of errors which occurred + * @param errorList Map containing the list of errors which occurred * during the copy operation * @param source Path of the resource to be copied * @param dest Destination path diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 7b25cf31ee..90d8e355e0 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -895,8 +895,8 @@ class Generator { private class GenerateVisitor extends Node.Visitor { /* - * Hashtable containing introspection information on tag handlers: - * : tag prefix : hashtable containing introspection on tag + * Map containing introspection information on tag handlers: + * : tag prefix : Map containing introspection on tag * handlers: : tag short name : introspection info of tag * handler for tag */ - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 10.1.x updated: Update comments. Hashtable usage was replaced with Map
This is an automated email from the ASF dual-hosted git repository. markt 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 a0dde7eb4d Update comments. Hashtable usage was replaced with Map a0dde7eb4d is described below commit a0dde7eb4d825376188259e1a33fb4de77ab2b30 Author: Mark Thomas AuthorDate: Mon Jan 16 17:21:51 2023 + Update comments. Hashtable usage was replaced with Map --- java/org/apache/catalina/servlets/CGIServlet.java| 10 +- java/org/apache/catalina/servlets/WebdavServlet.java | 2 +- java/org/apache/jasper/compiler/Generator.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/java/org/apache/catalina/servlets/CGIServlet.java b/java/org/apache/catalina/servlets/CGIServlet.java index c2309e8e58..d0755c6fdd 100644 --- a/java/org/apache/catalina/servlets/CGIServlet.java +++ b/java/org/apache/catalina/servlets/CGIServlet.java @@ -1444,7 +1444,7 @@ public final class CGIServlet extends HttpServlet { * respectively. * * @param command string full path to command to be executed - * @param env Hashtable with the desired script environment + * @param env Map with the desired script environment * @param wd File with the script's desired working directory * @param params ArrayList with the script's query command line * parameters as strings @@ -1508,11 +1508,11 @@ public final class CGIServlet extends HttpServlet { /** - * Converts a Hashtable to a String array by converting each - * key/value pair in the Hashtable to a String in the form - * "key=value" (hashkey + "=" + hash.get(hashkey).toString()) + * Converts a Map to a String array by converting each + * key/value pair in the Map to a String in the form + * "key=value" (key + "=" + map.get(key).toString()) * - * @param map Hashtable to convert + * @param map Map to convert * * @return converted string array * diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index f0c88f7d8d..36bf46a269 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -1576,7 +1576,7 @@ public class WebdavServlet extends DefaultServlet { /** * Copy a collection. * - * @param errorList Hashtable containing the list of errors which occurred + * @param errorList Map containing the list of errors which occurred * during the copy operation * @param source Path of the resource to be copied * @param dest Destination path diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 8f77afe2b1..e61afce60e 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -906,8 +906,8 @@ class Generator { private class GenerateVisitor extends Node.Visitor { /* - * Hashtable containing introspection information on tag handlers: - * : tag prefix : hashtable containing introspection on tag + * Map containing introspection information on tag handlers: + * : tag prefix : Map containing introspection on tag * handlers: : tag short name : introspection info of tag * handler for tag */ - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [tomcat] branch 10.1.x updated: Disable test for Java 16 onwards since performance is comparable
On 16/01/2023 12:32, Rainer Jung wrote: Any plans to backport this for TC 9? JreCompat seems to provide isJre16Available() for TC 9, so backport should work. I can confirm I still see the failures for 9.0.71, but only for Java 17 and 21 (most of the runs with Java 17 but not every run; Java 16 not tested, no failures for 8 and 11). TC 8.5 does not have isJre16Available(), so backporting there would be a bit bigger. Thanks and regards, I'll look at a back-port now. Mark Rainer Am 14.11.22 um 12:43 schrieb ma...@apache.org: This is an automated email from the ASF dual-hosted git repository. markt 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 1058eed2b6 Disable test for Java 16 onwards since performance is comparable 1058eed2b6 is described below commit 1058eed2b6e94f09b8f3ecdcac3be634baa01f76 Author: Mark Thomas AuthorDate: Mon Nov 14 11:42:53 2022 + Disable test for Java 16 onwards since performance is comparable --- test/org/apache/tomcat/util/buf/TestMessageBytes.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/org/apache/tomcat/util/buf/TestMessageBytes.java b/test/org/apache/tomcat/util/buf/TestMessageBytes.java index 3311996394..4abc1b6374 100644 --- a/test/org/apache/tomcat/util/buf/TestMessageBytes.java +++ b/test/org/apache/tomcat/util/buf/TestMessageBytes.java @@ -23,8 +23,11 @@ import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; import org.junit.Assert; +import org.junit.Assume; import org.junit.Test; +import org.apache.tomcat.util.compat.JreCompat; + public class TestMessageBytes { private static final String CONVERSION_STRING = @@ -100,6 +103,10 @@ public class TestMessageBytes { */ @Test public void testConversionPerformance() { + + // ISO_8859_1 conversion appears to be optimised in Java 16 onwards + Assume.assumeFalse(JreCompat.isJre16Available()); + long optimized = -1; long nonOptimized = -1; @@ -110,7 +117,7 @@ public class TestMessageBytes { * once to run the test and once more in case of unexpected CI /GC * slowness. The test will exit early if possible. * - * MeesageBytes only optimises conversion for ISO_8859_1 + * MessageBytes only optimises conversion for ISO_8859_1 */ for (int i = 0; i < 3; i++) { optimized = doTestOptimisedConversionPerformance(); - 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
[tomcat] 01/02: Refactor to avoid issues if JVM optimises conversion to ASCII
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 386051424c076577b388070d335ce7357fad681b Author: Mark Thomas AuthorDate: Mon Nov 14 11:38:38 2022 + Refactor to avoid issues if JVM optimises conversion to ASCII --- .../apache/tomcat/util/buf/TestMessageBytes.java | 79 ++ 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/test/org/apache/tomcat/util/buf/TestMessageBytes.java b/test/org/apache/tomcat/util/buf/TestMessageBytes.java index f2016f478d..3311996394 100644 --- a/test/org/apache/tomcat/util/buf/TestMessageBytes.java +++ b/test/org/apache/tomcat/util/buf/TestMessageBytes.java @@ -16,7 +16,10 @@ */ package org.apache.tomcat.util.buf; -import java.nio.charset.Charset; +import java.nio.CharBuffer; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.CharsetEncoder; +import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; import org.junit.Assert; @@ -24,6 +27,26 @@ import org.junit.Test; public class TestMessageBytes { +private static final String CONVERSION_STRING = +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"; + +private static final int CONVERSION_LOOPS = 100; + @Test public void testToStringFromNull() { MessageBytes mb = MessageBytes.newInstance(); @@ -73,8 +96,7 @@ public class TestMessageBytes { /* - * Checks the the optimized code is at least twice as fast as the - * non-optimized code. + * Checks the the optimized code is faster than the non-optimized code. */ @Test public void testConversionPerformance() { @@ -87,12 +109,12 @@ public class TestMessageBytes { * non-optimised code. Loop three times allows once to warn up the JVM * once to run the test and once more in case of unexpected CI /GC * slowness. The test will exit early if possible. + * + * MeesageBytes only optimises conversion for ISO_8859_1 */ for (int i = 0; i < 3; i++) { -optimized = doTestConversionPerformance(StandardCharsets.ISO_8859_1); -// US_ASCII chosen as the conversion is the same and it is another -// Charset available on all platforms. -nonOptimized = doTestConversionPerformance(StandardCharsets.US_ASCII); +optimized = doTestOptimisedConversionPerformance(); +nonOptimized = doTestConversionPerformance(); System.out.println(optimized + " " + nonOptimized); if (optimized * 2 < nonOptimized) { @@ -100,37 +122,36 @@ public class TestMessageBytes { } } -Assert.assertTrue("Non-optimised code was faster (" + nonOptimized + "ns) compared to optimized (" + optimized + "ns)", optimized < nonOptimized); +Assert.assertTrue("Non-optimised code was faster (" + nonOptimized + "ns) compared to optimized (" + +optimized + "ns)", optimized < nonOptimized); } -private long doTestConversionPerformance(Charset charset) { +private long doTestOptimisedConversionPerformance() { MessageBytes mb = MessageBytes.newInstance(); -int loops = 100; - long start = System.nanoTime(); -for (int i = 0; i < loops; i++) { +for (int i = 0; i < CONVERSION_LOOPS; i++) { mb.recycle(); -mb.setCharset(charset); - mb.setString("0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + - "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + -
[tomcat] 02/02: Disable test for Java 16 onwards since performance is comparable
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 65a8fab1df7a37042819a24d04dad600d213ceda Author: Mark Thomas AuthorDate: Mon Nov 14 11:42:53 2022 + Disable test for Java 16 onwards since performance is comparable --- test/org/apache/tomcat/util/buf/TestMessageBytes.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/org/apache/tomcat/util/buf/TestMessageBytes.java b/test/org/apache/tomcat/util/buf/TestMessageBytes.java index 3311996394..4abc1b6374 100644 --- a/test/org/apache/tomcat/util/buf/TestMessageBytes.java +++ b/test/org/apache/tomcat/util/buf/TestMessageBytes.java @@ -23,8 +23,11 @@ import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; import org.junit.Assert; +import org.junit.Assume; import org.junit.Test; +import org.apache.tomcat.util.compat.JreCompat; + public class TestMessageBytes { private static final String CONVERSION_STRING = @@ -100,6 +103,10 @@ public class TestMessageBytes { */ @Test public void testConversionPerformance() { + +// ISO_8859_1 conversion appears to be optimised in Java 16 onwards +Assume.assumeFalse(JreCompat.isJre16Available()); + long optimized = -1; long nonOptimized = -1; @@ -110,7 +117,7 @@ public class TestMessageBytes { * once to run the test and once more in case of unexpected CI /GC * slowness. The test will exit early if possible. * - * MeesageBytes only optimises conversion for ISO_8859_1 + * MessageBytes only optimises conversion for ISO_8859_1 */ for (int i = 0; i < 3; i++) { optimized = doTestOptimisedConversionPerformance(); - 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 (0220c6d577 -> 65a8fab1df)
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 0220c6d577 Branch name update new 386051424c Refactor to avoid issues if JVM optimises conversion to ASCII new 65a8fab1df Disable test for Java 16 onwards since performance is comparable 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: .../apache/tomcat/util/buf/TestMessageBytes.java | 86 ++ 1 file changed, 57 insertions(+), 29 deletions(-) - 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 (92b8bdf60b -> 94b2b6dfc5)
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 92b8bdf60b Branch name update new 2da103a135 Refactor to avoid issues if JVM optimises conversion to ASCII new 547a99bd1a Disable test for Java 16 onwards since performance is comparable new 94b2b6dfc5 Add a Jre16 check - required by unit tests 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: .../util/compat/Jre16Compat.java} | 34 ++--- .../org/apache/tomcat/util/compat/Jre19Compat.java | 2 +- java/org/apache/tomcat/util/compat/JreCompat.java | 44 +++ .../apache/tomcat/util/buf/TestMessageBytes.java | 86 ++ 4 files changed, 110 insertions(+), 56 deletions(-) copy java/org/apache/{coyote/ajp/AjpProtocol.java => tomcat/util/compat/Jre16Compat.java} (56%) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: Add a Jre16 check - required by unit tests
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 94b2b6dfc5b79ba3d533841d269ae511864dccf3 Author: Mark Thomas AuthorDate: Mon Jan 16 18:02:16 2023 + Add a Jre16 check - required by unit tests --- .../org/apache/tomcat/util/compat/Jre16Compat.java | 47 ++ .../org/apache/tomcat/util/compat/Jre19Compat.java | 2 +- java/org/apache/tomcat/util/compat/JreCompat.java | 44 +--- 3 files changed, 78 insertions(+), 15 deletions(-) diff --git a/java/org/apache/tomcat/util/compat/Jre16Compat.java b/java/org/apache/tomcat/util/compat/Jre16Compat.java new file mode 100644 index 00..ab436cde17 --- /dev/null +++ b/java/org/apache/tomcat/util/compat/Jre16Compat.java @@ -0,0 +1,47 @@ +/* + * 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.compat; + +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.res.StringManager; + +class Jre16Compat extends Jre9Compat { + +private static final Log log = LogFactory.getLog(Jre16Compat.class); +private static final StringManager sm = StringManager.getManager(Jre16Compat.class); + +private static final Class unixDomainSocketAddressClazz; + +static { +Class c1 = null; +try { +c1 = Class.forName("java.net.UnixDomainSocketAddress"); +} catch (ClassNotFoundException e) { +// Must be pre-Java 16 +log.debug(sm.getString("jre16Compat.javaPre16"), e); +} catch (IllegalArgumentException e) { +// Should never happen +log.error(sm.getString("jre16Compat.unexpected"), e); +} +unixDomainSocketAddressClazz = c1; +} + +static boolean isSupported() { +return unixDomainSocketAddressClazz != null; +} +} diff --git a/java/org/apache/tomcat/util/compat/Jre19Compat.java b/java/org/apache/tomcat/util/compat/Jre19Compat.java index 7f120c4d61..fb94810b40 100644 --- a/java/org/apache/tomcat/util/compat/Jre19Compat.java +++ b/java/org/apache/tomcat/util/compat/Jre19Compat.java @@ -22,7 +22,7 @@ import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.res.StringManager; -public class Jre19Compat extends Jre9Compat { +public class Jre19Compat extends Jre16Compat { private static final Log log = LogFactory.getLog(Jre19Compat.class); private static final StringManager sm = StringManager.getManager(Jre19Compat.class); diff --git a/java/org/apache/tomcat/util/compat/JreCompat.java b/java/org/apache/tomcat/util/compat/JreCompat.java index 6780664285..87fd07f5e1 100644 --- a/java/org/apache/tomcat/util/compat/JreCompat.java +++ b/java/org/apache/tomcat/util/compat/JreCompat.java @@ -45,6 +45,7 @@ public class JreCompat { private static final JreCompat instance; private static final boolean jre19Available; +private static final boolean jre16Available; private static final boolean jre11Available; private static final boolean jre9Available; private static final boolean jre8Available; @@ -57,21 +58,31 @@ public class JreCompat { if (Jre19Compat.isSupported()) { instance = new Jre19Compat(); jre19Available = true; +jre16Available = true; +jre9Available = true; +jre8Available = true; +} else if (Jre16Compat.isSupported()) { +instance = new Jre16Compat(); +jre19Available = false; +jre16Available = true; jre9Available = true; jre8Available = true; } else if (Jre9Compat.isSupported()) { instance = new Jre9Compat(); jre19Available = false; +jre16Available = false; jre9Available = true; jre8Available = true; } else if (Jre8Compat.isSupported()) { instance = new Jre8Compat(); jre19Available = false; +jre16Available = false; jre9Available = false; jre8Available = true;
[tomcat] 02/03: Disable test for Java 16 onwards since performance is comparable
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 547a99bd1a36e31f4d62afdf0dc985125f19133b Author: Mark Thomas AuthorDate: Mon Nov 14 11:42:53 2022 + Disable test for Java 16 onwards since performance is comparable --- test/org/apache/tomcat/util/buf/TestMessageBytes.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/org/apache/tomcat/util/buf/TestMessageBytes.java b/test/org/apache/tomcat/util/buf/TestMessageBytes.java index 3311996394..4abc1b6374 100644 --- a/test/org/apache/tomcat/util/buf/TestMessageBytes.java +++ b/test/org/apache/tomcat/util/buf/TestMessageBytes.java @@ -23,8 +23,11 @@ import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; import org.junit.Assert; +import org.junit.Assume; import org.junit.Test; +import org.apache.tomcat.util.compat.JreCompat; + public class TestMessageBytes { private static final String CONVERSION_STRING = @@ -100,6 +103,10 @@ public class TestMessageBytes { */ @Test public void testConversionPerformance() { + +// ISO_8859_1 conversion appears to be optimised in Java 16 onwards +Assume.assumeFalse(JreCompat.isJre16Available()); + long optimized = -1; long nonOptimized = -1; @@ -110,7 +117,7 @@ public class TestMessageBytes { * once to run the test and once more in case of unexpected CI /GC * slowness. The test will exit early if possible. * - * MeesageBytes only optimises conversion for ISO_8859_1 + * MessageBytes only optimises conversion for ISO_8859_1 */ for (int i = 0; i < 3; i++) { optimized = doTestOptimisedConversionPerformance(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: Refactor to avoid issues if JVM optimises conversion to ASCII
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 2da103a1353021f5549076707abcccf079322409 Author: Mark Thomas AuthorDate: Mon Nov 14 11:38:38 2022 + Refactor to avoid issues if JVM optimises conversion to ASCII --- .../apache/tomcat/util/buf/TestMessageBytes.java | 79 ++ 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/test/org/apache/tomcat/util/buf/TestMessageBytes.java b/test/org/apache/tomcat/util/buf/TestMessageBytes.java index f2016f478d..3311996394 100644 --- a/test/org/apache/tomcat/util/buf/TestMessageBytes.java +++ b/test/org/apache/tomcat/util/buf/TestMessageBytes.java @@ -16,7 +16,10 @@ */ package org.apache.tomcat.util.buf; -import java.nio.charset.Charset; +import java.nio.CharBuffer; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.CharsetEncoder; +import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; import org.junit.Assert; @@ -24,6 +27,26 @@ import org.junit.Test; public class TestMessageBytes { +private static final String CONVERSION_STRING = +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + +"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"; + +private static final int CONVERSION_LOOPS = 100; + @Test public void testToStringFromNull() { MessageBytes mb = MessageBytes.newInstance(); @@ -73,8 +96,7 @@ public class TestMessageBytes { /* - * Checks the the optimized code is at least twice as fast as the - * non-optimized code. + * Checks the the optimized code is faster than the non-optimized code. */ @Test public void testConversionPerformance() { @@ -87,12 +109,12 @@ public class TestMessageBytes { * non-optimised code. Loop three times allows once to warn up the JVM * once to run the test and once more in case of unexpected CI /GC * slowness. The test will exit early if possible. + * + * MeesageBytes only optimises conversion for ISO_8859_1 */ for (int i = 0; i < 3; i++) { -optimized = doTestConversionPerformance(StandardCharsets.ISO_8859_1); -// US_ASCII chosen as the conversion is the same and it is another -// Charset available on all platforms. -nonOptimized = doTestConversionPerformance(StandardCharsets.US_ASCII); +optimized = doTestOptimisedConversionPerformance(); +nonOptimized = doTestConversionPerformance(); System.out.println(optimized + " " + nonOptimized); if (optimized * 2 < nonOptimized) { @@ -100,37 +122,36 @@ public class TestMessageBytes { } } -Assert.assertTrue("Non-optimised code was faster (" + nonOptimized + "ns) compared to optimized (" + optimized + "ns)", optimized < nonOptimized); +Assert.assertTrue("Non-optimised code was faster (" + nonOptimized + "ns) compared to optimized (" + +optimized + "ns)", optimized < nonOptimized); } -private long doTestConversionPerformance(Charset charset) { +private long doTestOptimisedConversionPerformance() { MessageBytes mb = MessageBytes.newInstance(); -int loops = 100; - long start = System.nanoTime(); -for (int i = 0; i < loops; i++) { +for (int i = 0; i < CONVERSION_LOOPS; i++) { mb.recycle(); -mb.setCharset(charset); - mb.setString("0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + - "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" + -