From dev-return-203761-archive-asf-public=cust-asf.ponee.io@tomcat.apache.org Mon Nov 25 13:17:04 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 17E7A180607 for ; Mon, 25 Nov 2019 14:17:03 +0100 (CET) Received: (qmail 52017 invoked by uid 500); 25 Nov 2019 13:17:02 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 51882 invoked by uid 99); 25 Nov 2019 13:17:02 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Nov 2019 13:17:02 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id B3E158B690; Mon, 25 Nov 2019 13:17:01 +0000 (UTC) Date: Mon, 25 Nov 2019 13:17:01 +0000 To: "dev@tomcat.apache.org" Subject: [tomcat] branch 7.0.x updated: Fix potential test failure / hang if timing isn't as expected MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <157468782163.8462.5618446895970335627@gitbox.apache.org> From: markt@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: tomcat X-Git-Refname: refs/heads/7.0.x X-Git-Reftype: branch X-Git-Oldrev: 858f7e7d3d367f4654a95aa31f0ebf57185e12cc X-Git-Newrev: 609d10230ad1cb67c9745764ccee98450df89880 X-Git-Rev: 609d10230ad1cb67c9745764ccee98450df89880 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/7.0.x by this push: new 609d102 Fix potential test failure / hang if timing isn't as expected 609d102 is described below commit 609d10230ad1cb67c9745764ccee98450df89880 Author: Mark Thomas 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 9c7e723..3e5cb46 100644 --- a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java +++ b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java @@ -85,6 +85,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; @@ -98,6 +99,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); @@ -123,6 +125,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(); @@ -155,6 +160,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