tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [tomcat] branch 8.5.x updated: Fix potential test failure / hang if timing isn't as expected
Date Mon, 25 Nov 2019 12:18:26 GMT
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 2fedebf  Fix potential test failure / hang if timing isn't as expected
2fedebf is described below

commit 2fedebf15958fec037e036b94f8895a3bd0d2df2
Author: Mark Thomas <markt@apache.org>
AuthorDate: Mon Nov 25 11:36:33 2019 +0000

    Fix potential test failure / hang if timing isn't as expected
---
 test/org/apache/catalina/core/TestAsyncContextStateChanges.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
index 90f8521..f909484 100644
--- a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
+++ b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
@@ -76,6 +76,7 @@ public class TestAsyncContextStateChanges extends TomcatBaseTest {
     private ServletRequest servletRequest = null;
     private AsyncContext asyncContext = null;
     private AtomicBoolean failed = new AtomicBoolean();
+    private CountDownLatch servletLatch;
     private CountDownLatch threadLatch;
     private CountDownLatch closeLatch;
     private CountDownLatch endLatch;
@@ -89,6 +90,7 @@ public class TestAsyncContextStateChanges extends TomcatBaseTest {
 
         // Initialise tracking fields
         failed.set(true);
+        servletLatch = new CountDownLatch(1);
         threadLatch = new CountDownLatch(1);
         closeLatch = new CountDownLatch(1);
         endLatch = new CountDownLatch(1);
@@ -114,6 +116,9 @@ public class TestAsyncContextStateChanges extends TomcatBaseTest {
         client.connect();
         client.sendRequest();
 
+        // Wait for Servlet to start processing request
+        servletLatch.await();
+
         if (asyncEnd.isError()) {
             client.disconnect();
             closeLatch.countDown();
@@ -147,6 +152,8 @@ public class TestAsyncContextStateChanges extends TomcatBaseTest {
         @Override
         protected void doGet(HttpServletRequest req, HttpServletResponse resp)
                 throws ServletException, IOException {
+            servletLatch.countDown();
+
             if (dispatch) {
                 return;
             }


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


Mime
View raw message