You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/10/15 20:37:38 UTC

[tomcat] branch master updated (a80693f -> 8d4d663)

This is an automated email from the ASF dual-hosted git repository.

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


    from a80693f  Expand test for https://bz.apache.org/bugzilla/show_bug.cgi?id=63816
     new b0376a2  Refactor
     new 0a7deb5  Refactor
     new a730395  Remove an illegal state transition
     new 8d4d663  Hack to fix fialing test

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/coyote/AsyncStateMachine.java        | 20 ++++++--------------
 .../catalina/core/TestAsyncContextStateChanges.java  | 10 ++++++++++
 2 files changed, 16 insertions(+), 14 deletions(-)


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


[tomcat] 01/04: Refactor

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b0376a270b6471c782bb5882184af543acaa164b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 15 21:14:25 2019 +0100

    Refactor
---
 java/org/apache/coyote/AsyncStateMachine.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/AsyncStateMachine.java b/java/org/apache/coyote/AsyncStateMachine.java
index b4fa4a4..80759b8 100644
--- a/java/org/apache/coyote/AsyncStateMachine.java
+++ b/java/org/apache/coyote/AsyncStateMachine.java
@@ -278,10 +278,12 @@ class AsyncStateMachine {
      */
     synchronized SocketState asyncPostProcess() {
         if (state == AsyncState.COMPLETE_PENDING) {
-            doComplete();
+            clearNonBlockingListeners();
+            state = AsyncState.COMPLETING;
             return SocketState.ASYNC_END;
         } else if (state == AsyncState.DISPATCH_PENDING) {
-            doDispatch();
+            clearNonBlockingListeners();
+            state = AsyncState.DISPATCHING;
             return SocketState.ASYNC_END;
         } else  if (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP) {
             state = AsyncState.STARTED;


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


[tomcat] 02/04: Refactor

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0a7deb568827a7d55162fca0c2306a20b246530c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 15 21:16:11 2019 +0100

    Refactor
---
 java/org/apache/coyote/AsyncStateMachine.java | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/java/org/apache/coyote/AsyncStateMachine.java b/java/org/apache/coyote/AsyncStateMachine.java
index 80759b8..2060831 100644
--- a/java/org/apache/coyote/AsyncStateMachine.java
+++ b/java/org/apache/coyote/AsyncStateMachine.java
@@ -314,13 +314,8 @@ class AsyncStateMachine {
         if (!ContainerThreadMarker.isContainerThread() && state == AsyncState.STARTING) {
             state = AsyncState.COMPLETE_PENDING;
             return false;
-        } else {
-            return doComplete();
         }
-    }
-
 
-    private synchronized boolean doComplete() {
         clearNonBlockingListeners();
         boolean triggerDispatch = false;
         if (state == AsyncState.STARTING || state == AsyncState.MUST_ERROR) {
@@ -380,13 +375,8 @@ class AsyncStateMachine {
         if (!ContainerThreadMarker.isContainerThread() && state == AsyncState.STARTING) {
             state = AsyncState.DISPATCH_PENDING;
             return false;
-        } else {
-            return doDispatch();
         }
-    }
-
 
-    private synchronized boolean doDispatch() {
         clearNonBlockingListeners();
         boolean triggerDispatch = false;
         if (state == AsyncState.STARTING || state == AsyncState.MUST_ERROR) {


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


[tomcat] 03/04: Remove an illegal state transition

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a7303954ab34d45e1f4693a9484e0833bbf38c5b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 15 21:27:10 2019 +0100

    Remove an illegal state transition
---
 java/org/apache/coyote/AsyncStateMachine.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/AsyncStateMachine.java b/java/org/apache/coyote/AsyncStateMachine.java
index 2060831..71683a2 100644
--- a/java/org/apache/coyote/AsyncStateMachine.java
+++ b/java/org/apache/coyote/AsyncStateMachine.java
@@ -322,7 +322,7 @@ class AsyncStateMachine {
             // Processing is on a container thread so no need to transfer
             // processing to a new container thread
             state = AsyncState.MUST_COMPLETE;
-        } else if (state == AsyncState.STARTED || state == AsyncState.COMPLETE_PENDING) {
+        } else if (state == AsyncState.STARTED) {
             state = AsyncState.COMPLETING;
             // A dispatch to a container thread is always required.
             // If on a non-container thread, need to get back onto a container
@@ -383,7 +383,7 @@ class AsyncStateMachine {
             // Processing is on a container thread so no need to transfer
             // processing to a new container thread
             state = AsyncState.MUST_DISPATCH;
-        } else if (state == AsyncState.STARTED || state == AsyncState.DISPATCH_PENDING) {
+        } else if (state == AsyncState.STARTED) {
             state = AsyncState.DISPATCHING;
             // A dispatch to a container thread is always required.
             // If on a non-container thread, need to get back onto a container


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


[tomcat] 04/04: Hack to fix fialing test

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8d4d6637176816bb4d6c1f39d94e32bb28058d8d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 15 21:36:52 2019 +0100

    Hack to fix fialing test
---
 .../org/apache/catalina/core/TestAsyncContextStateChanges.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
index 5df1740..dc1cde9 100644
--- a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
+++ b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
@@ -196,6 +196,16 @@ public class TestAsyncContextStateChanges extends TomcatBaseTest {
             if (endTiming == EndTiming.THREAD_AFTER_EXIT) {
                 try {
                     threadLatch.await();
+                    /*
+                     * As much as I dislike it, I don't see any easy way around
+                     * this hack. The latch above is released as the Servlet
+                     * exits but we need to wait for the post processing to
+                     * complete for the test to work as intended. In real-world
+                     * applications this does mean that there is a real chance
+                     * of an ISE. We may need to increase this delay for some CI
+                     * systems.
+                     */
+                    Thread.sleep(1000);
                 } catch (InterruptedException e) {
                     // Ignore
                 }


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