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 2bb2d14  Fix CI failure observed in BuildBot
2bb2d14 is described below

commit 2bb2d148457b44de0e7f18e24c4d1531c905edf4
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Sep 8 19:14:19 2020 +0100

    Fix CI failure observed in BuildBot
    
    Make sure we avoid concurrent access to the same write object.
---
 test/org/apache/coyote/http2/TestAsyncTimeout.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestAsyncTimeout.java 
b/test/org/apache/coyote/http2/TestAsyncTimeout.java
index 8560229..0d827d7 100644
--- a/test/org/apache/coyote/http2/TestAsyncTimeout.java
+++ b/test/org/apache/coyote/http2/TestAsyncTimeout.java
@@ -147,7 +147,7 @@ public class TestAsyncTimeout extends Http2TestBase {
                 PrintWriter pw = asyncContext.getResponse().getWriter();
                 int counter = 0;
 
-                // If the test works running will be set too false before
+                // If the test works running will be set to false before
                 // counter reaches 50.
                 while (running && counter < 50) {
                     Thread.sleep(100);
@@ -183,6 +183,16 @@ public class TestAsyncTimeout extends Http2TestBase {
         @Override
         public void onTimeout(AsyncEvent event) throws IOException {
             ticker.end();
+            // Wait for the ticker to exit to avoid concurrent access to the
+            // response and associated writer.
+            // Excessively long timeout just in case things so wrong so test
+            // does not lock up.
+            try {
+                ticker.join(10 * 1000);
+            } catch (InterruptedException e) {
+                throw new IOException(e);
+            }
+
             if (ended.compareAndSet(false, true)) {
                 PrintWriter pw = 
event.getAsyncContext().getResponse().getWriter();
                 pw.write("PASS");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to