[GitHub] [tomcat] rmaucher commented on pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

2022-05-19 Thread GitBox


rmaucher commented on PR #515:
URL: https://github.com/apache/tomcat/pull/515#issuecomment-1131378209

   Good idea, the sync is overloaded in that case so this is risky, and other 
operations already use a servicesLock item for this reason.


-- 
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



Re: JDK 19 - Virtual Threads Testing!

2022-05-19 Thread Martin Grigorov
Hi Mark,

I confirm that all tests pass now!
Thank you!

Martin

On Wed, May 18, 2022 at 1:40 PM Mark Thomas  wrote:

> On 18/05/2022 10:25, Mark Thomas wrote:
> > Hi all,
> >
> > So of the three issues Martin identified, I've fixed 1 & 3 which were
> > the simple ones.
> >
> > For 1, the import handler needed updating to add the new classes added
> > to java.lang in Java 19.
> >
> > For 3, the memory leak protection code that stops executor threads
> > needed to be updated for some changes to Thread internals.
> >
> > The tricky one is 2.
> >
> > Prior to Java 19, the character -> byte encoders used an 8k buffer for
> > character data. This aligned with Tomcat's internals. This meant that
> > the new HEAD handling in the Servlet API had the same buffering
> > behaviour as Tomact's internals so GET and HEAD behaved the same way.
> >
> > In Java 19, the character -> byte encoders start with a 512 byte buffer
> > that may grow up to 8192 bytes. This means the buffering for HEAD
> > handling is different to the buffering for GET handling which in turn
> > means GET and HEAD see different headers (even accounting for allowed
> > differences).
> >
> > The issue is when responses are committed (and headers are fixed). The
> > HEAD tests examine the behaviour at the buffer boundaries including
> > reset behaviour. GET and HEAD effectively having different buffer sizes
> > triggers different behaviour for some of these resets which is why some
> > fail.
> >
> > I'm currently thinking about ways to tackle this but I don't yet have a
> > solution I'm completely happy with. Suggestions welcome.
>
> I found a solution. Since the issue was only with the legacy handling
> mode for HEAD requests, adjusting the response buffer size to compensate
> for the smaller char -> byte buffer addresses the issue.
>
> Mark
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


Re: JDK 19 - Virtual Threads Testing!

2022-05-19 Thread Martin Grigorov
Hi David,

The issues in Apache Tomcat have been fixed and now everything is OK with
JDK 19-ea+22-1598!

Regards,
Martin

On Mon, May 16, 2022 at 4:14 PM Martin Grigorov 
wrote:

> Hello Tomcat devs,
>
> Some tests fail with JDK 19-ea+22-1598:
>
>   [concat] Testsuites with failed tests:
>[concat] TEST-jakarta.el.TestImportHandlerStandardPackages.NIO.txt
>[concat] TEST-jakarta.el.TestImportHandlerStandardPackages.NIO2.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite0.NIO.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite0.NIO2.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite1.NIO.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite1.NIO2.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite1023.NIO.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite1023.NIO2.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite1024.NIO.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite1024.NIO2.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite1025.NIO.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite1025.NIO2.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite511.NIO.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite511.NIO2.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite512.NIO.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite512.NIO2.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite513.NIO.txt
>[concat]
> TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite513.NIO2.txt
>[concat]
> TEST-org.apache.catalina.loader.TestWebappClassLoaderExecutorMemoryLeak.NIO.txt
>[concat]
> TEST-org.apache.catalina.loader.TestWebappClassLoaderExecutorMemoryLeak.NIO2.txt
>
>
> Here are the error types:
>
>
> 1. Testsuite: jakarta.el.TestImportHandlerStandardPackages
> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.463 sec
>
> Testcase: testClassListsAreComplete took 0.444 sec
> FAILED
> java.lang.Thread.Builder.OfPlatform
> junit.framework.AssertionFailedError: java.lang.Thread.Builder.OfPlatform
> at
> jakarta.el.TestImportHandlerStandardPackages.lambda$checkPackageClassList$12(TestImportHandlerStandardPackages.java:77)
> at
> java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
> at
> java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
> at
> java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
>
>
> 2. TEST-jakarta.servlet.http.TestHttpServletDoHeadValidWrite0.NIO.txt
>
> 5-EndOfStream
>  expected:<-Header-[content-[length]-[0]]> but
> was:<-Header-[content-[type]-[text/plain;charset=UTF-8]]>
> at
> jakarta.servlet.http.HttpServletDoHeadBaseTest.testDoHeadHttp2(HttpServletDoHeadBaseTest.java:160)
> at
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>
> Testcase: testDoHead[467: true 8,192 true 1,023 FULL 0 true] took 2.129 sec
> FAILED
> expected:<4> but was:<5>
> junit.framework.AssertionFailedError: expected:<4> but was:<5>
> at
> jakarta.servlet.http.HttpServletDoHeadBaseTest.testDoHead(HttpServletDoHeadBaseTest.java:94)
> at
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>
> Testcase: testDoHeadHttp2[467: true 8,192 true 1,023 FULL 0 true] took
> 1.07 sec
> FAILED
> 3-HeadersStart
> 3-Header-[:status]-[200]
> 3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]
> 3-HeadersEnd
> 5-HeadersStart
> 5-Header-[:status]-[200]
> 5-Header-[content-type]-[text/plain;charset=UTF-8]
> 5-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]
> 5-HeadersEnd
> 5-EndOfStream
>  expected:<-Header-[[date]-[Wed, 11 Nov 2015 19:18:42 GMT]]> but
> was:<-Header-[[content-type]-[text/plain;charset=UTF-8]]>
> junit.framework.AssertionFailedError: 3-HeadersStart
> 3-Header-[:status]-[200]
> 3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]
> 3-HeadersEnd
> 5-HeadersStart
> 5-Header-[:status]-[200]
> 5-Header-[content-type]-[text/plain;charset=UTF-8]
> 5-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]
> 5-HeadersEnd
> 5-EndOfStream
>  expected:<-Header-[[date]-[Wed, 11 Nov 2015 19:18:42 GMT]]> but
> was:<-Header-[[content-type]-[text/plain;charset=UTF-8]]>
> at
> jakarta.servlet.http.HttpServletDoHeadBaseTest.testDoHeadHttp2(HttpServletDoHeadBaseTest.java:160)
> at
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>
>
>
> 3. Testcase: testTimerThreadLeak took 2.609 sec
> FAILED
> null
> junit.framework.AssertionFailedError
> at
> org.apache.catalina.loader.TestWeba

[tomcat] branch main updated: Fix deadlock on startup

2022-05-19 Thread remm
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 62594a6311 Fix deadlock on startup
62594a6311 is described below

commit 62594a6311ae186286dffa463523476a5704c6f3
Author: remm 
AuthorDate: Thu May 19 10:25:50 2022 +0200

Fix deadlock on startup

PR515. Involving only certain utility executor configurations. This
should use its own lock object as the main object is already synced
during the whole startup.
Submitted by Han Li.
---
 java/org/apache/catalina/core/StandardServer.java | 29 +--
 webapps/docs/changelog.xml|  4 
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/java/org/apache/catalina/core/StandardServer.java 
b/java/org/apache/catalina/core/StandardServer.java
index b2684b56f0..c0c472f613 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -187,6 +187,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
  * Utility executor with scheduling capabilities.
  */
 private ScheduledThreadPoolExecutor utilityExecutor = null;
+private final Object utilityExecutorLock = new Object();
 
 /**
  * Utility executor wrapper.
@@ -431,19 +432,21 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
 }
 
 
-private synchronized void reconfigureUtilityExecutor(int threads) {
-// The ScheduledThreadPoolExecutor doesn't use MaximumPoolSize, only 
CorePoolSize is available
-if (utilityExecutor != null) {
-utilityExecutor.setCorePoolSize(threads);
-} else {
-ScheduledThreadPoolExecutor scheduledThreadPoolExecutor =
-new ScheduledThreadPoolExecutor(threads,
-new TaskThreadFactory("Catalina-utility-", 
utilityThreadsAsDaemon, Thread.MIN_PRIORITY));
-scheduledThreadPoolExecutor.setKeepAliveTime(10, TimeUnit.SECONDS);
-scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true);
-
scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
-utilityExecutor = scheduledThreadPoolExecutor;
-utilityExecutorWrapper = new 
org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor(utilityExecutor);
+private void reconfigureUtilityExecutor(int threads) {
+synchronized (utilityExecutorLock) {
+// The ScheduledThreadPoolExecutor doesn't use MaximumPoolSize, 
only CorePoolSize is available
+if (utilityExecutor != null) {
+utilityExecutor.setCorePoolSize(threads);
+} else {
+ScheduledThreadPoolExecutor scheduledThreadPoolExecutor =
+new ScheduledThreadPoolExecutor(threads,
+new TaskThreadFactory("Catalina-utility-", 
utilityThreadsAsDaemon, Thread.MIN_PRIORITY));
+scheduledThreadPoolExecutor.setKeepAliveTime(10, 
TimeUnit.SECONDS);
+scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true);
+
scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+utilityExecutor = scheduledThreadPoolExecutor;
+utilityExecutorWrapper = new 
org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor(utilityExecutor);
+}
 }
 }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c1a182402b..283029c1b5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -120,6 +120,10 @@
 clearReferencesObjectStreamClassCaches when running on a
 JRE that includes a fix for the underlying memory leak. (markt)
   
+  
+515: Avoid deadlock on startup with some utility executor
+configurations. Submitted by Han Li. (remm)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Fix deadlock on startup

2022-05-19 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new e910d44ce5 Fix deadlock on startup
e910d44ce5 is described below

commit e910d44ce5b2483a8c8aa181833a17624d049aad
Author: remm 
AuthorDate: Thu May 19 10:25:50 2022 +0200

Fix deadlock on startup

PR515. Involving only certain utility executor configurations. This
should use its own lock object as the main object is already synced
during the whole startup.
Submitted by Han Li.
---
 java/org/apache/catalina/core/StandardServer.java | 29 +--
 webapps/docs/changelog.xml|  4 
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/java/org/apache/catalina/core/StandardServer.java 
b/java/org/apache/catalina/core/StandardServer.java
index d0ead54c4a..9c8069124d 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -191,6 +191,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
  * Utility executor with scheduling capabilities.
  */
 private ScheduledThreadPoolExecutor utilityExecutor = null;
+private final Object utilityExecutorLock = new Object();
 
 /**
  * Utility executor wrapper.
@@ -435,19 +436,21 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
 }
 
 
-private synchronized void reconfigureUtilityExecutor(int threads) {
-// The ScheduledThreadPoolExecutor doesn't use MaximumPoolSize, only 
CorePoolSize is available
-if (utilityExecutor != null) {
-utilityExecutor.setCorePoolSize(threads);
-} else {
-ScheduledThreadPoolExecutor scheduledThreadPoolExecutor =
-new ScheduledThreadPoolExecutor(threads,
-new TaskThreadFactory("Catalina-utility-", 
utilityThreadsAsDaemon, Thread.MIN_PRIORITY));
-scheduledThreadPoolExecutor.setKeepAliveTime(10, TimeUnit.SECONDS);
-scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true);
-
scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
-utilityExecutor = scheduledThreadPoolExecutor;
-utilityExecutorWrapper = new 
org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor(utilityExecutor);
+private void reconfigureUtilityExecutor(int threads) {
+synchronized (utilityExecutorLock) {
+// The ScheduledThreadPoolExecutor doesn't use MaximumPoolSize, 
only CorePoolSize is available
+if (utilityExecutor != null) {
+utilityExecutor.setCorePoolSize(threads);
+} else {
+ScheduledThreadPoolExecutor scheduledThreadPoolExecutor =
+new ScheduledThreadPoolExecutor(threads,
+new TaskThreadFactory("Catalina-utility-", 
utilityThreadsAsDaemon, Thread.MIN_PRIORITY));
+scheduledThreadPoolExecutor.setKeepAliveTime(10, 
TimeUnit.SECONDS);
+scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true);
+
scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+utilityExecutor = scheduledThreadPoolExecutor;
+utilityExecutorWrapper = new 
org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor(utilityExecutor);
+}
 }
 }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7996901586..89df868106 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -120,6 +120,10 @@
 clearReferencesObjectStreamClassCaches when running on a
 JRE that includes a fix for the underlying memory leak. (markt)
   
+  
+515: Avoid deadlock on startup with some utility executor
+configurations. Submitted by Han Li. (remm)
+  
 
   
   


-
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: Fix deadlock on startup

2022-05-19 Thread remm
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 192c0e0ec6 Fix deadlock on startup
192c0e0ec6 is described below

commit 192c0e0ec6bf87ef45b5cd7df16d5fc55683afab
Author: remm 
AuthorDate: Thu May 19 10:25:50 2022 +0200

Fix deadlock on startup

PR515. Involving only certain utility executor configurations. This
should use its own lock object as the main object is already synced
during the whole startup.
Submitted by Han Li.
---
 java/org/apache/catalina/core/StandardServer.java | 29 +--
 webapps/docs/changelog.xml|  4 
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/java/org/apache/catalina/core/StandardServer.java 
b/java/org/apache/catalina/core/StandardServer.java
index d0ead54c4a..9c8069124d 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -191,6 +191,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
  * Utility executor with scheduling capabilities.
  */
 private ScheduledThreadPoolExecutor utilityExecutor = null;
+private final Object utilityExecutorLock = new Object();
 
 /**
  * Utility executor wrapper.
@@ -435,19 +436,21 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
 }
 
 
-private synchronized void reconfigureUtilityExecutor(int threads) {
-// The ScheduledThreadPoolExecutor doesn't use MaximumPoolSize, only 
CorePoolSize is available
-if (utilityExecutor != null) {
-utilityExecutor.setCorePoolSize(threads);
-} else {
-ScheduledThreadPoolExecutor scheduledThreadPoolExecutor =
-new ScheduledThreadPoolExecutor(threads,
-new TaskThreadFactory("Catalina-utility-", 
utilityThreadsAsDaemon, Thread.MIN_PRIORITY));
-scheduledThreadPoolExecutor.setKeepAliveTime(10, TimeUnit.SECONDS);
-scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true);
-
scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
-utilityExecutor = scheduledThreadPoolExecutor;
-utilityExecutorWrapper = new 
org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor(utilityExecutor);
+private void reconfigureUtilityExecutor(int threads) {
+synchronized (utilityExecutorLock) {
+// The ScheduledThreadPoolExecutor doesn't use MaximumPoolSize, 
only CorePoolSize is available
+if (utilityExecutor != null) {
+utilityExecutor.setCorePoolSize(threads);
+} else {
+ScheduledThreadPoolExecutor scheduledThreadPoolExecutor =
+new ScheduledThreadPoolExecutor(threads,
+new TaskThreadFactory("Catalina-utility-", 
utilityThreadsAsDaemon, Thread.MIN_PRIORITY));
+scheduledThreadPoolExecutor.setKeepAliveTime(10, 
TimeUnit.SECONDS);
+scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true);
+
scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+utilityExecutor = scheduledThreadPoolExecutor;
+utilityExecutorWrapper = new 
org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor(utilityExecutor);
+}
 }
 }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 64835158d1..bdc0977b5f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -120,6 +120,10 @@
 clearReferencesObjectStreamClassCaches when running on a
 JRE that includes a fix for the underlying memory leak. (markt)
   
+  
+515: Avoid deadlock on startup with some utility executor
+configurations. Submitted by Han Li. (remm)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Trying to use Loom virtual threads with Tomcat

2022-05-19 Thread Mark Thomas

On 09/05/2022 19:01, Cay Horstmann wrote:

Il 03/05/2022 08:31, Cay Horstmann ha scritto:

Il 03/05/2022 07:25, Rémy Maucherat ha scritto:
On Tue, May 3, 2022 at 6:24 AM Cay Horstmann 
 wrote:


Hi, I am trying to experiment with Loom
(https://openjdk.java.net/jeps/425) virtual threads in Tomcat 10. There
is a nice extension point in server.xml where I can provide an Executor
and use it in the default Connector. It works like a charm--all my
requests run on a virtual thread, and AFAIK, nothing else does.

There is just one issue. It takes forever for Tomcat to execute the
virtual threads. I made a timestamp for each invocation of

public void execute(Runnable command)

called from org.apache.tomcat.util.net.AbstractEndpoint.processSocket

When I fire 1000 simultaneous requests, I can see that method being
invoked 1000 times, but it takes a while to work through the requests.
The last invocation occurs two minutes (!) from the sending of the 
requests.


When using the org.apache.catalina.core.StandardThreadExecutor, that
many requests are handled in 3 seconds.

Is there something that I am overlooking? I had hoped that execute 
would

be called near-instantly 1000 times, and then the Loom virtual threads
could show their mettle and execute concurrently.


I wanted to experiment with Loom, but most likely the current Tomcat
NIO(2) connector is not nice for that. I was thinking that
resurrecting the java.io code (actually: writing a new java.io
connector) could be a slightly better plan, but to be honest I don't
expect very good results. I wasn't planning to do it immediately since
Loom is so experimental right now.



I figured this out in the end. When using Nio2, changing the executor in 
server.xml doesn't seem useful. That executor is then used in the inner 
workings of the selector mechanism. That is probably not what anyone 
wants to do. But with Nio, plugging in Loom for running the servlet 
methods is very reasonable. There is only one issue. Loom cannot (yet) 
handle "synchronized".


Changing the synchronized block in 
org/apache/tomcat/util/net/SocketProcessorBase.run() to a ReentrantLock 
makes the Loom threads fly, with impressive performance.


Care to share the code you used to test this? I'd like to see if I can 
reproduce the results and get some numbers on the performance difference.


Thanks,

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Final reminder: ApacheCon North America call for presentations closing soon

2022-05-19 Thread Rich Bowen
[Note: You're receiving this because you are subscribed to one or more
Apache Software Foundation project mailing lists.]

This is your final reminder that the Call for Presetations for
ApacheCon North America 2022 will close at 00:01 GMT on Monday, May
23rd, 2022. Please don't wait! Get your talk proposals in now!

Details here: https://apachecon.com/acna2022/cfp.html

--Rich, for the ApacheCon Planners



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat] aooohan commented on pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

2022-05-19 Thread GitBox


aooohan commented on PR #515:
URL: https://github.com/apache/tomcat/pull/515#issuecomment-1131597904

   @rmaucher Thank u for reviewing my PR, it's an honour to contribute PR to 
Tomcat.


-- 
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



[GitHub] [tomcat] rmaucher closed pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

2022-05-19 Thread GitBox


rmaucher closed pull request #515: Bug:Deadlocks occur when both engine and 
host startStopThreads values are set and the latter value is larger than the 
former
URL: https://github.com/apache/tomcat/pull/515


-- 
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



[GitHub] [tomcat] rmaucher commented on pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

2022-05-19 Thread GitBox


rmaucher commented on PR #515:
URL: https://github.com/apache/tomcat/pull/515#issuecomment-1131604290

   Thanks a lot for your PR. Sorry, I forgot to close it after merging it 
manually. The fix will be in Tomcat 10.1.0-M16, 10.0.22, 9.0.64. Tomcat 8.5 is 
not affected since it doesn't have the utility executor feature.


-- 
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



[GitHub] [tomcat] markt-asf merged pull request #514: Registry gives inaccurate log message saying "Creating MBeanServer ... " after already created the MBeanServer

2022-05-19 Thread GitBox


markt-asf merged PR #514:
URL: https://github.com/apache/tomcat/pull/514


-- 
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



[GitHub] [tomcat] markt-asf commented on pull request #514: Registry gives inaccurate log message saying "Creating MBeanServer ... " after already created the MBeanServer

2022-05-19 Thread GitBox


markt-asf commented on PR #514:
URL: https://github.com/apache/tomcat/pull/514#issuecomment-1131660833

   Note that i18n strings are managed via poeditor
   https://cwiki.apache.org/confluence/display/TOMCAT/Managing+translations


-- 
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] 01/02: refine the log message

2022-05-19 Thread markt
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 dd8c37ec8ac2bba4a2988f35ca5823311e1fb96c
Author: Zishuo Ding 
AuthorDate: Wed May 11 11:03:59 2022 -0400

refine the log message
---
 java/org/apache/tomcat/util/modeler/Registry.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/modeler/Registry.java 
b/java/org/apache/tomcat/util/modeler/Registry.java
index a15fb0db2f..84cf831420 100644
--- a/java/org/apache/tomcat/util/modeler/Registry.java
+++ b/java/org/apache/tomcat/util/modeler/Registry.java
@@ -462,7 +462,7 @@ public class Registry implements RegistryMBean, 
MBeanRegistration {
 } else {
 server = ManagementFactory.getPlatformMBeanServer();
 if (log.isDebugEnabled()) {
-log.debug("Creating MBeanServer" + 
(System.currentTimeMillis() - t1));
+log.debug("Created MBeanServer" + 
(System.currentTimeMillis() - t1));
 }
 }
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/02: change the tense of the localstrings from complete to in progress

2022-05-19 Thread markt
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 28db32a55077600f706cdae50024e50aef663d63
Author: Zishuo Ding 
AuthorDate: Wed May 11 11:06:02 2022 -0400

change the tense of the localstrings from complete to in progress
---
 java/org/apache/coyote/LocalStrings.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/LocalStrings.properties 
b/java/org/apache/coyote/LocalStrings.properties
index 724a0e448e..b708730f45 100644
--- a/java/org/apache/coyote/LocalStrings.properties
+++ b/java/org/apache/coyote/LocalStrings.properties
@@ -38,7 +38,7 @@ abstractProtocol.closeConnectionsAwait=Waiting [{0}] 
milliseconds for existing c
 abstractProtocol.mbeanDeregistrationFailed=Failed to deregister MBean named 
[{0}] from MBean server [{1}]
 abstractProtocol.processorRegisterError=Error registering request processor
 abstractProtocol.processorUnregisterError=Error unregistering request processor
-abstractProtocol.waitingProcessor.add=Added processor [{0}] to waiting 
processors
+abstractProtocol.waitingProcessor.add=Adding processor [{0}] to waiting 
processors
 abstractProtocol.waitingProcessor.remove=Removed processor [{0}] from waiting 
processors
 
 abstractProtocolHandler.asyncTimeoutError=Error processing async timeouts


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Remove unnecessary code

2022-05-19 Thread markt
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 f1253c0737 Remove unnecessary code
f1253c0737 is described below

commit f1253c073720388ea4622bf1f5c28edaa767a4e2
Author: Mark Thomas 
AuthorDate: Thu May 19 14:03:40 2022 +0100

Remove unnecessary code
---
 java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git 
a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java 
b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
index 0e81e2e107..b9f7148ba0 100644
--- a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
+++ b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
@@ -165,7 +165,6 @@ public class NioReplicationTask extends AbstractRxTask {
 reader.access();
 ReadableByteChannel channel = (ReadableByteChannel) key.channel();
 int count=-1;
-buffer.clear(); // make buffer empty
 SocketAddress saddr = null;
 
 if (channel instanceof SocketChannel) {
@@ -276,8 +275,6 @@ public class NioReplicationTask extends AbstractRxTask {
 Runnable r = () -> {
 try {
 if (key.isValid()) {
-// cycle the selector so this key is active again
-key.selector().wakeup();
 // resume interest in OP_READ, OP_WRITE
 int resumeOps = key.interestOps() | SelectionKey.OP_READ;
 key.interestOps(resumeOps);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated (62594a6311 -> 28db32a550)

2022-05-19 Thread markt
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 62594a6311 Fix deadlock on startup
 new dd8c37ec8a refine the log message
 new 28db32a550 change the tense of the localstrings from complete to in 
progress

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/coyote/LocalStrings.properties| 2 +-
 java/org/apache/tomcat/util/modeler/Registry.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated (e910d44ce5 -> 9aae3a2798)

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


from e910d44ce5 Fix deadlock on startup
 new cbffa819f3 refine the log message
 new 13ee1503c8 change the tense of the localstrings from complete to in 
progress
 new 9aae3a2798 Remove unnecessary code

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java | 3 ---
 java/org/apache/coyote/LocalStrings.properties| 2 +-
 java/org/apache/tomcat/util/modeler/Registry.java | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/03: Remove unnecessary code

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 9aae3a2798a38b3d5c6e621f4106bee9d219e05a
Author: Mark Thomas 
AuthorDate: Thu May 19 14:03:40 2022 +0100

Remove unnecessary code
---
 java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git 
a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java 
b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
index 0e81e2e107..b9f7148ba0 100644
--- a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
+++ b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
@@ -165,7 +165,6 @@ public class NioReplicationTask extends AbstractRxTask {
 reader.access();
 ReadableByteChannel channel = (ReadableByteChannel) key.channel();
 int count=-1;
-buffer.clear(); // make buffer empty
 SocketAddress saddr = null;
 
 if (channel instanceof SocketChannel) {
@@ -276,8 +275,6 @@ public class NioReplicationTask extends AbstractRxTask {
 Runnable r = () -> {
 try {
 if (key.isValid()) {
-// cycle the selector so this key is active again
-key.selector().wakeup();
 // resume interest in OP_READ, OP_WRITE
 int resumeOps = key.interestOps() | SelectionKey.OP_READ;
 key.interestOps(resumeOps);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/03: refine the log message

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit cbffa819f325efc7dcc77c6fe63f5459c7fdc8d8
Author: Zishuo Ding 
AuthorDate: Wed May 11 11:03:59 2022 -0400

refine the log message
---
 java/org/apache/tomcat/util/modeler/Registry.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/modeler/Registry.java 
b/java/org/apache/tomcat/util/modeler/Registry.java
index a15fb0db2f..84cf831420 100644
--- a/java/org/apache/tomcat/util/modeler/Registry.java
+++ b/java/org/apache/tomcat/util/modeler/Registry.java
@@ -462,7 +462,7 @@ public class Registry implements RegistryMBean, 
MBeanRegistration {
 } else {
 server = ManagementFactory.getPlatformMBeanServer();
 if (log.isDebugEnabled()) {
-log.debug("Creating MBeanServer" + 
(System.currentTimeMillis() - t1));
+log.debug("Created MBeanServer" + 
(System.currentTimeMillis() - t1));
 }
 }
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/03: change the tense of the localstrings from complete to in progress

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 13ee1503c808fc9e2cdb034c35ecfd693f56cb3c
Author: Zishuo Ding 
AuthorDate: Wed May 11 11:06:02 2022 -0400

change the tense of the localstrings from complete to in progress
---
 java/org/apache/coyote/LocalStrings.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/LocalStrings.properties 
b/java/org/apache/coyote/LocalStrings.properties
index 724a0e448e..b708730f45 100644
--- a/java/org/apache/coyote/LocalStrings.properties
+++ b/java/org/apache/coyote/LocalStrings.properties
@@ -38,7 +38,7 @@ abstractProtocol.closeConnectionsAwait=Waiting [{0}] 
milliseconds for existing c
 abstractProtocol.mbeanDeregistrationFailed=Failed to deregister MBean named 
[{0}] from MBean server [{1}]
 abstractProtocol.processorRegisterError=Error registering request processor
 abstractProtocol.processorUnregisterError=Error unregistering request processor
-abstractProtocol.waitingProcessor.add=Added processor [{0}] to waiting 
processors
+abstractProtocol.waitingProcessor.add=Adding processor [{0}] to waiting 
processors
 abstractProtocol.waitingProcessor.remove=Removed processor [{0}] from waiting 
processors
 
 abstractProtocolHandler.asyncTimeoutError=Error processing async timeouts


-
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 (192c0e0ec6 -> 37adf9dc4b)

2022-05-19 Thread markt
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 192c0e0ec6 Fix deadlock on startup
 new 4f066532f4 refine the log message
 new 1d8a7bb24f change the tense of the localstrings from complete to in 
progress
 new 37adf9dc4b Remove unnecessary code

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java | 3 ---
 java/org/apache/coyote/LocalStrings.properties| 2 +-
 java/org/apache/tomcat/util/modeler/Registry.java | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/03: refine the log message

2022-05-19 Thread markt
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 4f066532f462b66b42869c846c05a39c91f6809b
Author: Zishuo Ding 
AuthorDate: Wed May 11 11:03:59 2022 -0400

refine the log message
---
 java/org/apache/tomcat/util/modeler/Registry.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/modeler/Registry.java 
b/java/org/apache/tomcat/util/modeler/Registry.java
index a15fb0db2f..84cf831420 100644
--- a/java/org/apache/tomcat/util/modeler/Registry.java
+++ b/java/org/apache/tomcat/util/modeler/Registry.java
@@ -462,7 +462,7 @@ public class Registry implements RegistryMBean, 
MBeanRegistration {
 } else {
 server = ManagementFactory.getPlatformMBeanServer();
 if (log.isDebugEnabled()) {
-log.debug("Creating MBeanServer" + 
(System.currentTimeMillis() - t1));
+log.debug("Created MBeanServer" + 
(System.currentTimeMillis() - t1));
 }
 }
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/03: Remove unnecessary code

2022-05-19 Thread markt
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 37adf9dc4bd38c162009cffbcbd6cecce4b91d23
Author: Mark Thomas 
AuthorDate: Thu May 19 14:03:40 2022 +0100

Remove unnecessary code
---
 java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git 
a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java 
b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
index 0e81e2e107..b9f7148ba0 100644
--- a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
+++ b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
@@ -165,7 +165,6 @@ public class NioReplicationTask extends AbstractRxTask {
 reader.access();
 ReadableByteChannel channel = (ReadableByteChannel) key.channel();
 int count=-1;
-buffer.clear(); // make buffer empty
 SocketAddress saddr = null;
 
 if (channel instanceof SocketChannel) {
@@ -276,8 +275,6 @@ public class NioReplicationTask extends AbstractRxTask {
 Runnable r = () -> {
 try {
 if (key.isValid()) {
-// cycle the selector so this key is active again
-key.selector().wakeup();
 // resume interest in OP_READ, OP_WRITE
 int resumeOps = key.interestOps() | SelectionKey.OP_READ;
 key.interestOps(resumeOps);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/03: change the tense of the localstrings from complete to in progress

2022-05-19 Thread markt
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 1d8a7bb24f4e409cdb5678a5b05a889d009f06a6
Author: Zishuo Ding 
AuthorDate: Wed May 11 11:06:02 2022 -0400

change the tense of the localstrings from complete to in progress
---
 java/org/apache/coyote/LocalStrings.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/LocalStrings.properties 
b/java/org/apache/coyote/LocalStrings.properties
index 724a0e448e..b708730f45 100644
--- a/java/org/apache/coyote/LocalStrings.properties
+++ b/java/org/apache/coyote/LocalStrings.properties
@@ -38,7 +38,7 @@ abstractProtocol.closeConnectionsAwait=Waiting [{0}] 
milliseconds for existing c
 abstractProtocol.mbeanDeregistrationFailed=Failed to deregister MBean named 
[{0}] from MBean server [{1}]
 abstractProtocol.processorRegisterError=Error registering request processor
 abstractProtocol.processorUnregisterError=Error unregistering request processor
-abstractProtocol.waitingProcessor.add=Added processor [{0}] to waiting 
processors
+abstractProtocol.waitingProcessor.add=Adding processor [{0}] to waiting 
processors
 abstractProtocol.waitingProcessor.remove=Removed processor [{0}] from waiting 
processors
 
 abstractProtocolHandler.asyncTimeoutError=Error processing async timeouts


-
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 (7cdce2a6ea -> 818a7a0378)

2022-05-19 Thread markt
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 7cdce2a6ea The ObjectStreamClass memory leak has been fixed in newer 
JREs
 new 26e2184e7f refine the log message
 new bb0a027910 change the tense of the localstrings from complete to in 
progress
 new 818a7a0378 Remove unnecessary code

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java | 3 ---
 java/org/apache/coyote/LocalStrings.properties| 2 +-
 java/org/apache/tomcat/util/modeler/Registry.java | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/03: refine the log message

2022-05-19 Thread markt
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 26e2184e7f43bd8512fe5a4652651a96c3b181c5
Author: Zishuo Ding 
AuthorDate: Wed May 11 11:03:59 2022 -0400

refine the log message
---
 java/org/apache/tomcat/util/modeler/Registry.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/modeler/Registry.java 
b/java/org/apache/tomcat/util/modeler/Registry.java
index 93d35769e6..25e36bd500 100644
--- a/java/org/apache/tomcat/util/modeler/Registry.java
+++ b/java/org/apache/tomcat/util/modeler/Registry.java
@@ -448,7 +448,7 @@ public class Registry implements RegistryMBean, 
MBeanRegistration {
 } else {
 server = ManagementFactory.getPlatformMBeanServer();
 if (log.isDebugEnabled()) {
-log.debug("Creating MBeanServer" + 
(System.currentTimeMillis() - t1));
+log.debug("Created MBeanServer" + 
(System.currentTimeMillis() - t1));
 }
 }
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/03: change the tense of the localstrings from complete to in progress

2022-05-19 Thread markt
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 bb0a0279104924935ff60a5af9b258157c80ea9b
Author: Zishuo Ding 
AuthorDate: Wed May 11 11:06:02 2022 -0400

change the tense of the localstrings from complete to in progress
---
 java/org/apache/coyote/LocalStrings.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/LocalStrings.properties 
b/java/org/apache/coyote/LocalStrings.properties
index 3fa1192899..4f110d4112 100644
--- a/java/org/apache/coyote/LocalStrings.properties
+++ b/java/org/apache/coyote/LocalStrings.properties
@@ -37,7 +37,7 @@ abstractProtocol.closeConnectionsAwait=Waiting [{0}] 
milliseconds for existing c
 abstractProtocol.mbeanDeregistrationFailed=Failed to deregister MBean named 
[{0}] from MBean server [{1}]
 abstractProtocol.processorRegisterError=Error registering request processor
 abstractProtocol.processorUnregisterError=Error unregistering request processor
-abstractProtocol.waitingProcessor.add=Added processor [{0}] to waiting 
processors
+abstractProtocol.waitingProcessor.add=Adding processor [{0}] to waiting 
processors
 abstractProtocol.waitingProcessor.remove=Removed processor [{0}] from waiting 
processors
 
 abstractProtocolHandler.destroy=Destroying ProtocolHandler [{0}]


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/03: Remove unnecessary code

2022-05-19 Thread markt
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 818a7a03788477284ca7376026e400ab54961ea4
Author: Mark Thomas 
AuthorDate: Thu May 19 14:03:40 2022 +0100

Remove unnecessary code
---
 java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git 
a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java 
b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
index fb0d213377..24366d258b 100644
--- a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
+++ b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java
@@ -165,7 +165,6 @@ public class NioReplicationTask extends AbstractRxTask {
 reader.access();
 ReadableByteChannel channel = (ReadableByteChannel) key.channel();
 int count=-1;
-buffer.clear(); // make buffer empty
 SocketAddress saddr = null;
 
 if (channel instanceof SocketChannel) {
@@ -279,8 +278,6 @@ public class NioReplicationTask extends AbstractRxTask {
 public void run() {
 try {
 if (key.isValid()) {
-// cycle the selector so this key is active again
-key.selector().wakeup();
 // resume interest in OP_READ, OP_WRITE
 int resumeOps = key.interestOps() | 
SelectionKey.OP_READ;
 key.interestOps(resumeOps);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 66060] Registry gives inaccurate log message saying "Creating MBeanServer ... " after already created the MBeanServer

2022-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66060

Mark Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #2 from Mark Thomas  ---
Thanks for the PR.

Fixed in:
- 10.1.x for 10.1.0-M16 onwards
- 10.0.x for 10.0.22 onwards
- 9.0.x for 9.0.64 onwards
- 8.5.x for 8.5.80 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 66068] Asynchronous request processing changes IP behind RemoteIpValve

2022-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66068

--- Comment #1 from Mark Thomas  ---
I think the fix for this is fairly simple. If the request is in async mode, we
don't reset the request in the finally block after calling the next Valve in
the pipeline.

Assuming there are no objections to this approach, I'll apply a patch to that
effect in a couple of days.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 66077] New: Deadlock when concurrent processing of incoming HTTP/2 frames

2022-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66077

Bug ID: 66077
   Summary: Deadlock when concurrent processing of incoming HTTP/2
frames
   Product: Tomcat 10
   Version: 10.0.16
  Hardware: All
OS: other
Status: NEW
  Severity: normal
  Priority: P2
 Component: Connectors
  Assignee: dev@tomcat.apache.org
  Reporter: r...@tier1app.com
  Target Milestone: --

Application is running on 

Tomcat: 10.0.16.0
JDK: 1.8.0_144-b01 Open JDK
OS Version: Cent OS 7.3.1611

All of sudden application is becoming unresponsive because 600+ threads are
getting in to BLOCKED states because of the deadlock caused in tomcat. Below
are the threads which is causing deadlock:

https-openssl-apr-443-exec-486
PRIORITY : 5
THREAD ID : 0X0220D800
NATIVE ID : 0X471A
NATIVE ID (DECIMAL) : 18202
STATE : BLOCKED


stackTrace:
java.lang.Thread.State: BLOCKED (on object monitor)
at
org.apache.coyote.http2.StreamStateMachine.receivedReset(StreamStateMachine.java:107)
- waiting to lock <0x0006d8af60f8> (a
org.apache.coyote.http2.StreamStateMachine)
at org.apache.coyote.http2.Stream.receiveReset(Stream.java:180)
at
org.apache.coyote.http2.Http2UpgradeHandler.close(Http2UpgradeHandler.java:1200)
at
org.apache.coyote.http2.Http2UpgradeHandler.handleAppInitiatedIOException(Http2UpgradeHandler.java:803)
at
org.apache.coyote.http2.Http2UpgradeHandler.writeBody(Http2UpgradeHandler.java:785)
- locked <0x0006d741dbb8> (a
org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper)
at org.apache.coyote.http2.Stream$StreamOutputBuffer.flush(Stream.java:945)
- locked <0x0006d86fbf18> (a
org.apache.coyote.http2.Stream$StreamOutputBuffer)
at org.apache.coyote.http2.Stream$StreamOutputBuffer.flush(Stream.java:882)
- locked <0x0006d86fbf18> (a
org.apache.coyote.http2.Stream$StreamOutputBuffer)
at org.apache.coyote.http2.Stream$StreamOutputBuffer.flush(Stream.java:1005)
at org.apache.coyote.http2.Http2OutputBuffer.flush(Http2OutputBuffer.java:77)
at org.apache.coyote.http2.StreamProcessor.flush(StreamProcessor.java:242)
at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:402)
at org.apache.coyote.Response.action(Response.java:210)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:306)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:273)
at org.apache.catalina.connector.CoyoteWriter.flush(CoyoteWriter.java:94)
at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:162)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:981)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:489)
at org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:158)
at
org.apache.jsp.error_jsp._jspx_meth_template_005finsert_005f1(error_jsp.java:254)
at org.apache.jsp.error_jsp._jspx_meth_html_005fhtml_005f0(error_jsp.java:171)
at org.apache.jsp.error_jsp._jspService(error_jsp.java:128)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:443)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:367)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:295)
at
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:387)
at
org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:233)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:353)
at org.apache.coyote.http2.StreamProcessor.service(StreamProcessor.java:413)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.http2.StreamProcessor.process(StreamProcessor.java:74)
- locked <0x0006d70414c8> (a org.apache.coyote.http2.StreamProcessor)
at org.apache.coyote.http2.StreamRunnable.run(StreamRunnable.

[Bug 66077] Deadlock when concurrent processing of incoming HTTP/2 frames

2022-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66077

Ram Lakshmanan  changed:

   What|Removed |Added

 CC||r...@tier1app.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 66077] Deadlock when concurrent processing of incoming HTTP/2 frames

2022-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66077

Ram Lakshmanan  changed:

   What|Removed |Added

URL||https://fastthread.io/my-th
   ||read-report.jsp?p=c2hhcmVkL
   ||zIwMjIvMDUvMTgvLS10aHJlYWRf
   ||ZHVtcF8yODEwLS0xLTI1LTEw&&s
   ||=t

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1901074 - in /tomcat/site/trunk: docs/presentations.html xdocs/presentations.xml

2022-05-19 Thread schultz
Author: schultz
Date: Thu May 19 19:00:24 2022
New Revision: 1901074

URL: http://svn.apache.org/viewvc?rev=1901074&view=rev
Log:
Add "id" to Migration from AJP -> HTTP presentation.

Modified:
tomcat/site/trunk/docs/presentations.html
tomcat/site/trunk/xdocs/presentations.xml

Modified: tomcat/site/trunk/docs/presentations.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/presentations.html?rev=1901074&r1=1901073&r2=1901074&view=diff
==
--- tomcat/site/trunk/docs/presentations.html (original)
+++ tomcat/site/trunk/docs/presentations.html Thu May 19 19:00:24 2022
@@ -76,7 +76,7 @@ li.targeted {
 Tomcat: From a Cluster to a Cloud - Jean-Frederic Clere,
 https://www.youtube.com/watch?v=COsTWphp2fk";>video
   
-  
+  
 Migrating from AJP to HTTP: It's About Time - Christopher Schultz,
 https://people.apache.org/~schultz/presentations/ApacheCon%20NA%202020/Migrating%20from%20AJP%20to%20HTTP.pdf";>slides,
 https://www.youtube.com/watch?v=qUjUEvGFstI";>video

Modified: tomcat/site/trunk/xdocs/presentations.xml
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/presentations.xml?rev=1901074&r1=1901073&r2=1901074&view=diff
==
--- tomcat/site/trunk/xdocs/presentations.xml (original)
+++ tomcat/site/trunk/xdocs/presentations.xml Thu May 19 19:00:24 2022
@@ -84,7 +84,7 @@ li.targeted {
 Tomcat: From a Cluster to a Cloud - Jean-Frederic Clere,
 https://www.youtube.com/watch?v=COsTWphp2fk";>video
   
-  
+  
 Migrating from AJP to HTTP: It's About Time - Christopher Schultz,
 https://people.apache.org/~schultz/presentations/ApacheCon%20NA%202020/Migrating%20from%20AJP%20to%20HTTP.pdf";>slides,
 https://www.youtube.com/watch?v=qUjUEvGFstI";>video



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 66076] Final block of encrypted response payload not being sent occasionally over TLS

2022-05-19 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=66076

--- Comment #3 from Mark Thomas  ---
Thanks for the analysis. What you describe makes sense to me. It looks like the
non-blocking variant of bug 65448.

My current thinking is that SocketWrapper.flushNonBlocking() needs an NIO
specific implementation that can take account of the status of netOutBuffer in
NioSecureChannel.

Once we have a potential fix, are you in a position to either builds Tomcat
9.0.x yourself from source and/or test a 9.0.x dev build I provide for you?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Possible Connector doc update with NIO & NIO2

2022-05-19 Thread David Blevins
Hey All,

I was picking through the connector docs generating some code from the 
descriptions and I noticed there are a handful of properties common between NIO 
and NIO2.

 - socket.appReadBufSize
 - socket.appWriteBufSize
 - socket.directBuffer
 - socket.directSslBuffer
 - useSendfile

These attributes have the exact same description in both the NIO and NIO2 
sections.  Should they be moved into the "Java TCP socket attributes" section 
which is somewhat dedicated to attributes NIO and NIO2 have in common?

Note, I do definitely see there are attributes with the same name but different 
descriptions/defaults.  In particular:

 - socket.bufferPool
 - socket.processorCache

Should I submit a PR to move some or all of the first 5 or should they be left 
where they are?


-David



smime.p7s
Description: S/MIME cryptographic signature


Re: Possible Connector doc update with NIO & NIO2

2022-05-19 Thread David Blevins
> On May 19, 2022, at 5:16 PM, David Blevins  wrote:
> 
> - useSendfile
> 

Quick correction.  This one seems to be common between NIO, NIO2 and Apr and 
has the same description in all three.  Potentially it could go in the "Common 
Attributes" section.


-David



smime.p7s
Description: S/MIME cryptographic signature


[tomcat] branch main updated (f1253c0737 -> 690c559667)

2022-05-19 Thread markt
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 f1253c0737 Remove unnecessary code
 new c48714554a Add Javadoc
 new 1c84dc9b43 Add @Override
 new 6d67ccb711 Remove unused code
 new 690c559667 Refactor for cleaner code and to avoid NPE warnings from IDE

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/jakarta/security/auth/message/ClientAuth.java | 39 ++
 java/jakarta/security/auth/message/ServerAuth.java | 39 ++
 java/org/apache/catalina/connector/Response.java   |  5 ++-
 .../catalina/filters/CsrfPreventionFilter.java |  2 ++
 java/org/apache/coyote/http2/Stream.java   |  8 +
 .../apache/tomcat/util/net/jsse/TestPEMFile.java   |  3 +-
 6 files changed, 91 insertions(+), 5 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/04: Add @Override

2022-05-19 Thread markt
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 1c84dc9b4339a033daf1a0fc643a9d0093b20520
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:45 2022 +0100

Add @Override
---
 java/org/apache/catalina/filters/CsrfPreventionFilter.java | 2 ++
 java/org/apache/coyote/http2/Stream.java   | 8 
 2 files changed, 10 insertions(+)

diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java 
b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
index cde762e76b..e623c9fbab 100644
--- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java
+++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
@@ -372,12 +372,14 @@ public class CsrfPreventionFilter extends 
CsrfPreventionFilterBase {
 };
 }
 
+@Override
 public void add(T key) {
 synchronized (cache) {
 cache.put(key, null);
 }
 }
 
+@Override
 public boolean contains(T key) {
 synchronized (cache) {
 return cache.containsKey(key);
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index f0d5207e43..dacc2392ad 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -1167,6 +1167,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final boolean isReadyForRead() {
 ensureBuffersExist();
 
@@ -1183,6 +1184,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final synchronized boolean isRequestBodyFullyRead() {
 return (inBuffer == null || inBuffer.position() == 0) && 
isInputFinished();
 }
@@ -1200,6 +1202,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 /*
  * Called after placing some data in the inBuffer.
  */
+@Override
 final synchronized void onDataAvailable() throws IOException {
 if (closed) {
 swallowUnread();
@@ -1224,12 +1227,14 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final ByteBuffer getInBuffer() {
 ensureBuffersExist();
 return inBuffer;
 }
 
 
+@Override
 final synchronized void insertReplayedBody(ByteChunk body) {
 inBuffer = ByteBuffer.wrap(body.getBytes(),  body.getOffset(),  
body.getLength());
 }
@@ -1251,6 +1256,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final void receiveReset() {
 if (inBuffer != null) {
 synchronized (inBuffer) {
@@ -1260,6 +1266,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final void notifyEof() {
 if (inBuffer != null) {
 synchronized (inBuffer) {
@@ -1268,6 +1275,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final void swallowUnread() throws IOException {
 synchronized (this) {
 closed = true;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 04/04: Refactor for cleaner code and to avoid NPE warnings from IDE

2022-05-19 Thread markt
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 690c5596675623e498ced941d7acad2bbcb2f32b
Author: Mark Thomas 
AuthorDate: Fri May 20 06:48:35 2022 +0100

Refactor for cleaner code and to avoid NPE warnings from IDE
---
 java/org/apache/catalina/connector/Response.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 8eff0ad778..57ad601602 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -1291,18 +1291,17 @@ public class Response implements HttpServletResponse {
 // If no ROOT context is defined, the context can be null.
 // In this case, the default Tomcat values are assumed, but without
 // reference to org.apache.catalina.STRICT_SERVLET_COMPLIANCE.
-boolean reqHasContext = (context != null);
 String locationUri;
 // Relative redirects require HTTP/1.1
 if (getRequest().getCoyoteRequest().getSupportsRelativeRedirects() 
&&
-(!reqHasContext || context.getUseRelativeRedirects())) {
+(context == null || context.getUseRelativeRedirects())) {
 locationUri = location;
 } else {
 locationUri = toAbsolute(location);
 }
 setStatus(status);
 setHeader("Location", locationUri);
-if (reqHasContext && context.getSendRedirectBody()) {
+if (context != null && context.getSendRedirectBody()) {
 PrintWriter writer = getWriter();
 writer.print(sm.getString("coyoteResponse.sendRedirect.note",
 Escape.htmlElementContent(locationUri)));


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/04: Remove unused code

2022-05-19 Thread markt
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 6d67ccb71135f542667b7a5241f429a1272136ad
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:57 2022 +0100

Remove unused code
---
 test/org/apache/tomcat/util/net/jsse/TestPEMFile.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java 
b/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
index 31afc954c6..afefdebd1b 100644
--- a/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
+++ b/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
@@ -18,7 +18,6 @@ package org.apache.tomcat.util.net.jsse;
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URISyntaxException;
 import java.security.PrivateKey;
 
 import org.junit.Assert;
@@ -77,7 +76,7 @@ public class TestPEMFile {
 }
 
 
-private String getPath(String file) throws URISyntaxException, IOException 
{
+private String getPath(String file) throws IOException {
 String packageName = this.getClass().getPackageName();
 String path = packageName.replace(".", File.separator);
 File f = new File("test" + File.separator + path + File.separator + 
file);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/04: Add Javadoc

2022-05-19 Thread markt
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 c48714554aaa422d16d1cbfdcc075a89252e6dc6
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:21 2022 +0100

Add Javadoc
---
 java/jakarta/security/auth/message/ClientAuth.java | 39 ++
 java/jakarta/security/auth/message/ServerAuth.java | 39 ++
 2 files changed, 78 insertions(+)

diff --git a/java/jakarta/security/auth/message/ClientAuth.java 
b/java/jakarta/security/auth/message/ClientAuth.java
index f9aab007df..063075f35a 100644
--- a/java/jakarta/security/auth/message/ClientAuth.java
+++ b/java/jakarta/security/auth/message/ClientAuth.java
@@ -20,13 +20,52 @@ import javax.security.auth.Subject;
 
 public interface ClientAuth {
 
+/**
+ * Secure (authenticate) the request.
+ *
+ * @param messageInfo   The associated request and response
+ * @param clientSubject The subject that represents the source of the
+ *  request
+ *
+ * @return An AuthStatus instance that represents the result of the
+ * authentication
+ *
+ * @throws AuthException If the a failure occurred in a manner that
+ *   prevented the failure from being communicated via
+ *   messageInfo
+ */
 AuthStatus secureRequest(MessageInfo messageInfo, Subject clientSubject) 
throws AuthException;
 
+/**
+ * Validate a response.
+ *
+ * @param messageInfo   The associated request and response
+ * @param clientSubject The subject that represents the recipient of 
the
+ *  response
+ * @param serviceSubjectThe subject that represents the source of the
+ *  response
+ *
+ * @return An AuthStatus instance that represents the result of the
+ * validation
+ *
+ * @throws AuthException If the a failure occurred in a manner that
+ *   prevented the failure from being communicated via
+ *   messageInfo
+ */
 default AuthStatus validateResponse(MessageInfo messageInfo, Subject 
clientSubject,
 Subject serviceSubject) throws AuthException {
 return AuthStatus.SUCCESS;
 }
 
+/**
+ * Remove principals and/or credentials from the subject that were
+ * previously added by this authentication mechanism.
+ *
+ * @param messageInfo   The associated request and response
+ * @param subject   The subject to clean
+ *
+ * @throws AuthException If the a failure occurred
+ */
 default void cleanSubject(MessageInfo messageInfo, Subject subject) throws 
AuthException {
 // NO-OP
 }
diff --git a/java/jakarta/security/auth/message/ServerAuth.java 
b/java/jakarta/security/auth/message/ServerAuth.java
index a5b0a8a323..d0777618f5 100644
--- a/java/jakarta/security/auth/message/ServerAuth.java
+++ b/java/jakarta/security/auth/message/ServerAuth.java
@@ -20,13 +20,52 @@ import javax.security.auth.Subject;
 
 public interface ServerAuth {
 
+/**
+ * Validate the request.
+ *
+ * @param messageInfo   The associated request and response
+ * @param clientSubject The subject that represents the source of the
+ *  request
+ * @param serviceSubjectThe subject that represents the recipient of 
the
+ *  request
+ *
+ * @return An AuthStatus instance that represents the result of the
+ * validation
+ *
+ * @throws AuthException If the a failure occurred in a manner that
+ *   prevented the failure from being communicated via
+ *   messageInfo
+ */
 AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject,
 Subject serviceSubject) throws AuthException;
 
+/**
+ * Secure (authenticate) the response.
+ *
+ * @param messageInfo   The associated request and response
+ * @param serviceSubjectThe subject that represents the source of the
+ *  response
+ *
+ * @return An AuthStatus instance that represents the result of the
+ * authentication
+ *
+ * @throws AuthException If the a failure occurred in a manner that
+ *   prevented the failure from being communicated via
+ *   messageInfo
+ */
 default AuthStatus secureResponse(MessageInfo messageInfo, Subject 
serviceSubject) throws AuthException {
 return AuthStatus.SUCCESS;
 }
 
+/**
+ * Remove principals and/or credentials from the subject that were
+ * previously added by this authentication mechanism.
+ *
+ * @param messageInfo   The associated request and response
+ * @param subje

[tomcat] branch 10.0.x updated (9aae3a2798 -> ebbeb0b943)

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


from 9aae3a2798 Remove unnecessary code
 new d1ac5ece13 Remove unused code
 new 26204b79db Add @Override
 new 16fa5e03a1 Refactor for cleaner code and to avoid NPE warnings from IDE
 new ebbeb0b943 Fix IDE warnings

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/connector/Response.java   | 5 ++---
 java/org/apache/catalina/filters/CsrfPreventionFilter.java | 2 ++
 java/org/apache/coyote/http2/Stream.java   | 8 
 java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java| 7 ---
 test/org/apache/tomcat/util/net/jsse/TestPEMFile.java  | 3 +--
 5 files changed, 13 insertions(+), 12 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/04: Add @Override

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 26204b79db50613eba830e3d03c8a614a3bea35b
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:45 2022 +0100

Add @Override
---
 java/org/apache/catalina/filters/CsrfPreventionFilter.java | 2 ++
 java/org/apache/coyote/http2/Stream.java   | 8 
 2 files changed, 10 insertions(+)

diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java 
b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
index 7e5143b620..c0d904e0c4 100644
--- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java
+++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
@@ -384,12 +384,14 @@ public class CsrfPreventionFilter extends 
CsrfPreventionFilterBase {
 };
 }
 
+@Override
 public void add(T key) {
 synchronized (cache) {
 cache.put(key, null);
 }
 }
 
+@Override
 public boolean contains(T key) {
 synchronized (cache) {
 return cache.containsKey(key);
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index d1074c4cff..caff2138a4 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -1162,6 +1162,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final boolean isReadyForRead() {
 ensureBuffersExist();
 
@@ -1178,6 +1179,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final synchronized boolean isRequestBodyFullyRead() {
 return (inBuffer == null || inBuffer.position() == 0) && 
isInputFinished();
 }
@@ -1195,6 +1197,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 /*
  * Called after placing some data in the inBuffer.
  */
+@Override
 final synchronized void onDataAvailable() throws IOException {
 if (closed) {
 swallowUnread();
@@ -1219,12 +1222,14 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final ByteBuffer getInBuffer() {
 ensureBuffersExist();
 return inBuffer;
 }
 
 
+@Override
 final synchronized void insertReplayedBody(ByteChunk body) {
 inBuffer = ByteBuffer.wrap(body.getBytes(),  body.getOffset(),  
body.getLength());
 }
@@ -1246,6 +1251,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final void receiveReset() {
 if (inBuffer != null) {
 synchronized (inBuffer) {
@@ -1255,6 +1261,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final void notifyEof() {
 if (inBuffer != null) {
 synchronized (inBuffer) {
@@ -1263,6 +1270,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final void swallowUnread() throws IOException {
 synchronized (this) {
 closed = true;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/04: Remove unused code

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit d1ac5ece13f3bfe29ec8a2ea5dc8c5e8af0b08e8
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:57 2022 +0100

Remove unused code
---
 test/org/apache/tomcat/util/net/jsse/TestPEMFile.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java 
b/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
index bfce46067b..7adba1d6ab 100644
--- a/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
+++ b/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
@@ -18,7 +18,6 @@ package org.apache.tomcat.util.net.jsse;
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URISyntaxException;
 import java.security.PrivateKey;
 
 import org.junit.Assert;
@@ -77,7 +76,7 @@ public class TestPEMFile {
 }
 
 
-private String getPath(String file) throws URISyntaxException, IOException 
{
+private String getPath(String file) throws IOException {
 String packageName = this.getClass().getPackage().getName();
 String path = packageName.replace(".", File.separator);
 File f = new File("test" + File.separator + path + File.separator + 
file);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 04/04: Fix IDE warnings

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit ebbeb0b943d5a6f8c4e3491c48324a9b59600dfa
Author: Mark Thomas 
AuthorDate: Fri May 20 06:55:36 2022 +0100

Fix IDE warnings
---
 java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java 
b/java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java
index f6dbef1dd8..7315c5889b 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java
@@ -142,7 +142,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getMaxConnLifetimeMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getMaxConnLifetimeMillis();
 
 /**
@@ -171,7 +170,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getMaxWaitMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getMaxWaitMillis();
 
 /**
@@ -179,7 +177,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getMinEvictableIdleTimeMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getMinEvictableIdleTimeMillis();
 
 /**
@@ -229,7 +226,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getRemoveAbandonedTimeout()}.
  */
-@SuppressWarnings("javadoc")
 int getRemoveAbandonedTimeout();
 
 /**
@@ -237,7 +233,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getSoftMinEvictableIdleTimeMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getSoftMinEvictableIdleTimeMillis();
 
 /**
@@ -266,7 +261,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getTimeBetweenEvictionRunsMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getTimeBetweenEvictionRunsMillis();
 
 /**
@@ -295,7 +289,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getValidationQueryTimeout()}.
  */
-@SuppressWarnings("javadoc")
 int getValidationQueryTimeout();
 
 /**


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/04: Refactor for cleaner code and to avoid NPE warnings from IDE

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 16fa5e03a13a16859569c93822efc5a852b4e57d
Author: Mark Thomas 
AuthorDate: Fri May 20 06:48:35 2022 +0100

Refactor for cleaner code and to avoid NPE warnings from IDE
---
 java/org/apache/catalina/connector/Response.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index d0bdc3003e..4fdeb704a8 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -1328,18 +1328,17 @@ public class Response implements HttpServletResponse {
 // If no ROOT context is defined, the context can be null.
 // In this case, the default Tomcat values are assumed, but without
 // reference to org.apache.catalina.STRICT_SERVLET_COMPLIANCE.
-boolean reqHasContext = (context != null);
 String locationUri;
 // Relative redirects require HTTP/1.1
 if (getRequest().getCoyoteRequest().getSupportsRelativeRedirects() 
&&
-(!reqHasContext || context.getUseRelativeRedirects())) {
+(context == null || context.getUseRelativeRedirects())) {
 locationUri = location;
 } else {
 locationUri = toAbsolute(location);
 }
 setStatus(status);
 setHeader("Location", locationUri);
-if (reqHasContext && context.getSendRedirectBody()) {
+if (context != null && context.getSendRedirectBody()) {
 PrintWriter writer = getWriter();
 writer.print(sm.getString("coyoteResponse.sendRedirect.note",
 Escape.htmlElementContent(locationUri)));


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/04: Remove unused code

2022-05-19 Thread markt
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 598ab4838607f61940d8a6062d7cdf9371e45f24
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:57 2022 +0100

Remove unused code
---
 test/org/apache/tomcat/util/net/jsse/TestPEMFile.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java 
b/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
index bfce46067b..7adba1d6ab 100644
--- a/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
+++ b/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
@@ -18,7 +18,6 @@ package org.apache.tomcat.util.net.jsse;
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URISyntaxException;
 import java.security.PrivateKey;
 
 import org.junit.Assert;
@@ -77,7 +76,7 @@ public class TestPEMFile {
 }
 
 
-private String getPath(String file) throws URISyntaxException, IOException 
{
+private String getPath(String file) throws IOException {
 String packageName = this.getClass().getPackage().getName();
 String path = packageName.replace(".", File.separator);
 File f = new File("test" + File.separator + path + File.separator + 
file);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 04/04: Fix IDE warnings

2022-05-19 Thread markt
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 df5504c67b187796ad18aa49ffdecaa449dff34f
Author: Mark Thomas 
AuthorDate: Fri May 20 06:55:36 2022 +0100

Fix IDE warnings
---
 java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java 
b/java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java
index f6dbef1dd8..7315c5889b 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java
@@ -142,7 +142,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getMaxConnLifetimeMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getMaxConnLifetimeMillis();
 
 /**
@@ -171,7 +170,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getMaxWaitMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getMaxWaitMillis();
 
 /**
@@ -179,7 +177,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getMinEvictableIdleTimeMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getMinEvictableIdleTimeMillis();
 
 /**
@@ -229,7 +226,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getRemoveAbandonedTimeout()}.
  */
-@SuppressWarnings("javadoc")
 int getRemoveAbandonedTimeout();
 
 /**
@@ -237,7 +233,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getSoftMinEvictableIdleTimeMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getSoftMinEvictableIdleTimeMillis();
 
 /**
@@ -266,7 +261,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getTimeBetweenEvictionRunsMillis()}.
  */
-@SuppressWarnings("javadoc")
 long getTimeBetweenEvictionRunsMillis();
 
 /**
@@ -295,7 +289,6 @@ public interface DataSourceMXBean {
  *
  * @return {@link BasicDataSource#getValidationQueryTimeout()}.
  */
-@SuppressWarnings("javadoc")
 int getValidationQueryTimeout();
 
 /**


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/03: Remove unused code

2022-05-19 Thread markt
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 47fb2e2071fc89222dde33dfc7e34373987cf688
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:57 2022 +0100

Remove unused code
---
 test/org/apache/tomcat/util/net/jsse/TestPEMFile.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java 
b/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
index bfce46067b..7adba1d6ab 100644
--- a/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
+++ b/test/org/apache/tomcat/util/net/jsse/TestPEMFile.java
@@ -18,7 +18,6 @@ package org.apache.tomcat.util.net.jsse;
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URISyntaxException;
 import java.security.PrivateKey;
 
 import org.junit.Assert;
@@ -77,7 +76,7 @@ public class TestPEMFile {
 }
 
 
-private String getPath(String file) throws URISyntaxException, IOException 
{
+private String getPath(String file) throws IOException {
 String packageName = this.getClass().getPackage().getName();
 String path = packageName.replace(".", File.separator);
 File f = new File("test" + File.separator + path + File.separator + 
file);


-
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 (818a7a0378 -> 077c0c5c10)

2022-05-19 Thread markt
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 818a7a0378 Remove unnecessary code
 new 47fb2e2071 Remove unused code
 new 9f15371802 Add @Override
 new 077c0c5c10 Refactor for cleaner code and to avoid NPE warnings from IDE

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/connector/Response.java   | 5 ++---
 java/org/apache/catalina/filters/CsrfPreventionFilter.java | 2 ++
 java/org/apache/coyote/http2/Stream.java   | 8 
 test/org/apache/tomcat/util/net/jsse/TestPEMFile.java  | 3 +--
 4 files changed, 13 insertions(+), 5 deletions(-)


-
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 (37adf9dc4b -> df5504c67b)

2022-05-19 Thread markt
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 37adf9dc4b Remove unnecessary code
 new 598ab48386 Remove unused code
 new be6166f4de Add @Override
 new 619aab7c35 Refactor for cleaner code and to avoid NPE warnings from IDE
 new df5504c67b Fix IDE warnings

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/connector/Response.java   | 5 ++---
 java/org/apache/catalina/filters/CsrfPreventionFilter.java | 2 ++
 java/org/apache/coyote/http2/Stream.java   | 8 
 java/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.java| 7 ---
 test/org/apache/tomcat/util/net/jsse/TestPEMFile.java  | 3 +--
 5 files changed, 13 insertions(+), 12 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/04: Add @Override

2022-05-19 Thread markt
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 be6166f4de7781a1ccd411c561ac870da36b60c8
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:45 2022 +0100

Add @Override
---
 java/org/apache/catalina/filters/CsrfPreventionFilter.java | 2 ++
 java/org/apache/coyote/http2/Stream.java   | 8 
 2 files changed, 10 insertions(+)

diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java 
b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
index 77c0aa3ae1..4ffb7e2277 100644
--- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java
+++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
@@ -384,12 +384,14 @@ public class CsrfPreventionFilter extends 
CsrfPreventionFilterBase {
 };
 }
 
+@Override
 public void add(T key) {
 synchronized (cache) {
 cache.put(key, null);
 }
 }
 
+@Override
 public boolean contains(T key) {
 synchronized (cache) {
 return cache.containsKey(key);
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 72cf285c22..0b25f6a942 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -1162,6 +1162,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final boolean isReadyForRead() {
 ensureBuffersExist();
 
@@ -1178,6 +1179,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final synchronized boolean isRequestBodyFullyRead() {
 return (inBuffer == null || inBuffer.position() == 0) && 
isInputFinished();
 }
@@ -1195,6 +1197,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 /*
  * Called after placing some data in the inBuffer.
  */
+@Override
 final synchronized void onDataAvailable() throws IOException {
 if (closed) {
 swallowUnread();
@@ -1219,12 +1222,14 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final ByteBuffer getInBuffer() {
 ensureBuffersExist();
 return inBuffer;
 }
 
 
+@Override
 final synchronized void insertReplayedBody(ByteChunk body) {
 inBuffer = ByteBuffer.wrap(body.getBytes(),  body.getOffset(),  
body.getLength());
 }
@@ -1246,6 +1251,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final void receiveReset() {
 if (inBuffer != null) {
 synchronized (inBuffer) {
@@ -1255,6 +1261,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final void notifyEof() {
 if (inBuffer != null) {
 synchronized (inBuffer) {
@@ -1263,6 +1270,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final void swallowUnread() throws IOException {
 synchronized (this) {
 closed = true;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/03: Add @Override

2022-05-19 Thread markt
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 9f15371802a40a4ca9da168d7b5130247d93994e
Author: Mark Thomas 
AuthorDate: Fri May 20 06:47:45 2022 +0100

Add @Override
---
 java/org/apache/catalina/filters/CsrfPreventionFilter.java | 2 ++
 java/org/apache/coyote/http2/Stream.java   | 8 
 2 files changed, 10 insertions(+)

diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java 
b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
index 77c0aa3ae1..4ffb7e2277 100644
--- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java
+++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
@@ -384,12 +384,14 @@ public class CsrfPreventionFilter extends 
CsrfPreventionFilterBase {
 };
 }
 
+@Override
 public void add(T key) {
 synchronized (cache) {
 cache.put(key, null);
 }
 }
 
+@Override
 public boolean contains(T key) {
 synchronized (cache) {
 return cache.containsKey(key);
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 28bbb4b702..3445e9fc34 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -1224,6 +1224,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final boolean isReadyForRead() {
 ensureBuffersExist();
 
@@ -1240,6 +1241,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final synchronized boolean isRequestBodyFullyRead() {
 return (inBuffer == null || inBuffer.position() == 0) && 
isInputFinished();
 }
@@ -1257,6 +1259,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 /*
  * Called after placing some data in the inBuffer.
  */
+@Override
 final synchronized void onDataAvailable() throws IOException {
 if (closed) {
 swallowUnread();
@@ -1281,12 +1284,14 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final ByteBuffer getInBuffer() {
 ensureBuffersExist();
 return inBuffer;
 }
 
 
+@Override
 final synchronized void insertReplayedBody(ByteChunk body) {
 inBuffer = ByteBuffer.wrap(body.getBytes(),  body.getOffset(),  
body.getLength());
 }
@@ -1308,6 +1313,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 
 
+@Override
 final void receiveReset() {
 if (inBuffer != null) {
 synchronized (inBuffer) {
@@ -1317,6 +1323,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final void notifyEof() {
 if (inBuffer != null) {
 synchronized (inBuffer) {
@@ -1325,6 +1332,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 }
 }
 
+@Override
 final void swallowUnread() throws IOException {
 synchronized (this) {
 closed = true;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/04: Refactor for cleaner code and to avoid NPE warnings from IDE

2022-05-19 Thread markt
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 619aab7c353beb5cecdad31c31097187e2f1eb35
Author: Mark Thomas 
AuthorDate: Fri May 20 06:48:35 2022 +0100

Refactor for cleaner code and to avoid NPE warnings from IDE
---
 java/org/apache/catalina/connector/Response.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 032225b5c5..6d22590cb6 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -1367,18 +1367,17 @@ public class Response implements HttpServletResponse {
 // If no ROOT context is defined, the context can be null.
 // In this case, the default Tomcat values are assumed, but without
 // reference to org.apache.catalina.STRICT_SERVLET_COMPLIANCE.
-boolean reqHasContext = (context != null);
 String locationUri;
 // Relative redirects require HTTP/1.1
 if (getRequest().getCoyoteRequest().getSupportsRelativeRedirects() 
&&
-(!reqHasContext || context.getUseRelativeRedirects())) {
+(context == null || context.getUseRelativeRedirects())) {
 locationUri = location;
 } else {
 locationUri = toAbsolute(location);
 }
 setStatus(status);
 setHeader("Location", locationUri);
-if (reqHasContext && context.getSendRedirectBody()) {
+if (context != null && context.getSendRedirectBody()) {
 PrintWriter writer = getWriter();
 writer.print(sm.getString("coyoteResponse.sendRedirect.note",
 Escape.htmlElementContent(locationUri)));


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/03: Refactor for cleaner code and to avoid NPE warnings from IDE

2022-05-19 Thread markt
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 077c0c5c10ecc314dbcda60542a65a1b3439cef9
Author: Mark Thomas 
AuthorDate: Fri May 20 06:48:35 2022 +0100

Refactor for cleaner code and to avoid NPE warnings from IDE
---
 java/org/apache/catalina/connector/Response.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index e0f320fe05..b38667061b 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -1362,18 +1362,17 @@ public class Response implements HttpServletResponse {
 // If no ROOT context is defined, the context can be null.
 // In this case, the default Tomcat values are assumed, but without
 // reference to org.apache.catalina.STRICT_SERVLET_COMPLIANCE.
-boolean reqHasContext = (context != null);
 String locationUri;
 // Relative redirects require HTTP/1.1
 if (getRequest().getCoyoteRequest().getSupportsRelativeRedirects() 
&&
-(!reqHasContext || context.getUseRelativeRedirects())) {
+(context == null || context.getUseRelativeRedirects())) {
 locationUri = location;
 } else {
 locationUri = toAbsolute(location);
 }
 setStatus(status);
 setHeader("Location", locationUri);
-if (reqHasContext && context.getSendRedirectBody()) {
+if (context != null && context.getSendRedirectBody()) {
 PrintWriter writer = getWriter();
 writer.print(sm.getString("coyoteResponse.sendRedirect.note",
 Escape.htmlElementContent(locationUri)));


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Refactor in preparation for fixing BZ 66077

2022-05-19 Thread markt
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 b37c463f21 Refactor in preparation for fixing BZ 66077
b37c463f21 is described below

commit b37c463f218772e4cc8196d7d98577ae773ad2ce
Author: Mark Thomas 
AuthorDate: Fri May 20 07:51:07 2022 +0100

Refactor in preparation for fixing BZ 66077
---
 java/org/apache/tomcat/util/net/NioEndpoint.java   | 23 ++
 .../apache/tomcat/util/net/SocketWrapperBase.java  | 21 +---
 .../apache/coyote/http2/TestAbstractStream.java|  5 +
 3 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 5e547a2e32..e8348e90f0 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1293,6 +1293,29 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 }
 
 
+@Override
+protected boolean flushNonBlocking() throws IOException {
+boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+
+// Write to the socket, if there is anything to write
+if (dataLeft) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+
+if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
+dataLeft = nonBlockingWriteBuffer.write(this, false);
+
+if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+}
+
+return dataLeft;
+}
+
+
 @Override
 protected void doWrite(boolean block, ByteBuffer buffer) throws 
IOException {
 int n = 0;
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index bcfd2c4239..e32525ba0d 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -725,26 +725,7 @@ public abstract class SocketWrapperBase {
 }
 
 
-protected boolean flushNonBlocking() throws IOException {
-boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-
-// Write to the socket, if there is anything to write
-if (dataLeft) {
-doWrite(false);
-dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-}
-
-if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
-dataLeft = nonBlockingWriteBuffer.write(this, false);
-
-if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
-doWrite(false);
-dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-}
-}
-
-return dataLeft;
-}
+protected abstract boolean flushNonBlocking() throws IOException;
 
 
 /**
diff --git a/test/org/apache/coyote/http2/TestAbstractStream.java 
b/test/org/apache/coyote/http2/TestAbstractStream.java
index 3ed0151dcf..79dca9ab23 100644
--- a/test/org/apache/coyote/http2/TestAbstractStream.java
+++ b/test/org/apache/coyote/http2/TestAbstractStream.java
@@ -359,6 +359,11 @@ public class TestAbstractStream {
 protected void doClose() {
 }
 
+@Override
+protected boolean flushNonBlocking() throws IOException {
+return false;
+}
+
 @Override
 protected void doWrite(boolean block, ByteBuffer from) throws 
IOException {
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Refactor in preparation for fixing BZ 66077

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 79f63e129e Refactor in preparation for fixing BZ 66077
79f63e129e is described below

commit 79f63e129eefa929470c27e0111a500f447d115a
Author: Mark Thomas 
AuthorDate: Fri May 20 07:51:07 2022 +0100

Refactor in preparation for fixing BZ 66077
---
 java/org/apache/tomcat/util/net/AprEndpoint.java   | 23 ++
 java/org/apache/tomcat/util/net/NioEndpoint.java   | 23 ++
 .../apache/tomcat/util/net/SocketWrapperBase.java  | 21 +---
 3 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 7e9f99478a..5b7c457880 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2395,6 +2395,29 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 }
 
 
+@Override
+protected boolean flushNonBlocking() throws IOException {
+boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+
+// Write to the socket, if there is anything to write
+if (dataLeft) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+
+if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
+dataLeft = nonBlockingWriteBuffer.write(this, false);
+
+if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+}
+
+return dataLeft;
+}
+
+
 @Override
 protected void doWrite(boolean block, ByteBuffer from) throws 
IOException {
 Lock readLock = getBlockingStatusReadLock();
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 1b691a5603..0a832b60b9 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1316,6 +1316,29 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 }
 
 
+@Override
+protected boolean flushNonBlocking() throws IOException {
+boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+
+// Write to the socket, if there is anything to write
+if (dataLeft) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+
+if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
+dataLeft = nonBlockingWriteBuffer.write(this, false);
+
+if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+}
+
+return dataLeft;
+}
+
+
 @Override
 protected void doWrite(boolean block, ByteBuffer buffer) throws 
IOException {
 int n = 0;
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index 61ce372161..e6182a9c4f 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -706,26 +706,7 @@ public abstract class SocketWrapperBase {
 }
 
 
-protected boolean flushNonBlocking() throws IOException {
-boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-
-// Write to the socket, if there is anything to write
-if (dataLeft) {
-doWrite(false);
-dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-}
-
-if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
-dataLeft = nonBlockingWriteBuffer.write(this, false);
-
-if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
-doWrite(false);
-dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-}
-}
-
-return dataLeft;
-}
+protected abstract boolean flushNonBlocking() throws IOException;
 
 
 /**


-
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: Refactor in preparation for fixing BZ 66077

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 6f6d55296f Refactor in preparation for fixing BZ 66077
6f6d55296f is described below

commit 6f6d55296f6532d46dfd886bd9eca1f79beb62dd
Author: Mark Thomas 
AuthorDate: Fri May 20 07:51:07 2022 +0100

Refactor in preparation for fixing BZ 66077
---
 java/org/apache/tomcat/util/net/AprEndpoint.java   | 23 ++
 java/org/apache/tomcat/util/net/NioEndpoint.java   | 23 ++
 .../apache/tomcat/util/net/SocketWrapperBase.java  | 21 +---
 3 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 1b5f170064..c02e90fc09 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2391,6 +2391,29 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 }
 
 
+@Override
+protected boolean flushNonBlocking() throws IOException {
+boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+
+// Write to the socket, if there is anything to write
+if (dataLeft) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+
+if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
+dataLeft = nonBlockingWriteBuffer.write(this, false);
+
+if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+}
+
+return dataLeft;
+}
+
+
 @Override
 protected void doWrite(boolean block, ByteBuffer from) throws 
IOException {
 Lock readLock = getBlockingStatusReadLock();
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 3c7c8e68a0..78f4d3ca53 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1343,6 +1343,29 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 }
 
 
+@Override
+protected boolean flushNonBlocking() throws IOException {
+boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+
+// Write to the socket, if there is anything to write
+if (dataLeft) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+
+if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
+dataLeft = nonBlockingWriteBuffer.write(this, false);
+
+if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+}
+
+return dataLeft;
+}
+
+
 @Override
 protected void doWrite(boolean block, ByteBuffer buffer) throws 
IOException {
 int n = 0;
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index 3c1da33be4..67a6d0f08d 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -736,26 +736,7 @@ public abstract class SocketWrapperBase {
 }
 
 
-protected boolean flushNonBlocking() throws IOException {
-boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-
-// Write to the socket, if there is anything to write
-if (dataLeft) {
-doWrite(false);
-dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-}
-
-if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
-dataLeft = nonBlockingWriteBuffer.write(this, false);
-
-if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
-doWrite(false);
-dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-}
-}
-
-return dataLeft;
-}
+protected abstract boolean flushNonBlocking() throws IOException;
 
 
 /**


-
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: Refactor in preparation for fixing BZ 66077

2022-05-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new e81d5ef18c Refactor in preparation for fixing BZ 66077
e81d5ef18c is described below

commit e81d5ef18cf6553c6cc332caa8c1435f4bbe3e71
Author: Mark Thomas 
AuthorDate: Fri May 20 07:51:07 2022 +0100

Refactor in preparation for fixing BZ 66077
---
 java/org/apache/tomcat/util/net/AprEndpoint.java   | 23 ++
 java/org/apache/tomcat/util/net/NioEndpoint.java   | 23 ++
 .../apache/tomcat/util/net/SocketWrapperBase.java  | 21 +---
 3 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 11f3f9f13c..8b89646168 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2327,6 +2327,29 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 }
 
 
+@Override
+protected boolean flushNonBlocking() throws IOException {
+boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+
+// Write to the socket, if there is anything to write
+if (dataLeft) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+
+if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
+dataLeft = nonBlockingWriteBuffer.write(this, false);
+
+if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+}
+
+return dataLeft;
+}
+
+
 @Override
 protected void doWrite(boolean block, ByteBuffer from) throws 
IOException {
 Lock readLock = getBlockingStatusReadLock();
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 87e44f019d..ab9b2552f5 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1243,6 +1243,29 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 }
 
 
+@Override
+protected boolean flushNonBlocking() throws IOException {
+boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+
+// Write to the socket, if there is anything to write
+if (dataLeft) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+
+if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
+dataLeft = nonBlockingWriteBuffer.write(this, false);
+
+if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
+doWrite(false);
+dataLeft = !socketBufferHandler.isWriteBufferEmpty();
+}
+}
+
+return dataLeft;
+}
+
+
 @Override
 protected void doWrite(boolean block, ByteBuffer buffer) throws 
IOException {
 int n = 0;
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index 7a224d483b..4a3d489a9a 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -736,26 +736,7 @@ public abstract class SocketWrapperBase {
 }
 
 
-protected boolean flushNonBlocking() throws IOException {
-boolean dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-
-// Write to the socket, if there is anything to write
-if (dataLeft) {
-doWrite(false);
-dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-}
-
-if (!dataLeft && !nonBlockingWriteBuffer.isEmpty()) {
-dataLeft = nonBlockingWriteBuffer.write(this, false);
-
-if (!dataLeft && !socketBufferHandler.isWriteBufferEmpty()) {
-doWrite(false);
-dataLeft = !socketBufferHandler.isWriteBufferEmpty();
-}
-}
-
-return dataLeft;
-}
+protected abstract boolean flushNonBlocking() throws IOException;
 
 
 /**


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org