You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2019/11/23 19:57:24 UTC

[tomcat] branch 7.0.x updated: BZ 63950 - Limit wait time in a test case.

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

kkolinko 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 858f7e7  BZ 63950 - Limit wait time in a test case.
858f7e7 is described below

commit 858f7e7d3d367f4654a95aa31f0ebf57185e12cc
Author: Konstantin Kolinko <kk...@apache.org>
AuthorDate: Sat Nov 23 21:05:50 2019 +0300

    BZ 63950 - Limit wait time in a test case.
    
    Limit waiting time for endLatch of TestAsyncContextStateChanges#testAsync(),
    so that the test does not hang indefinitely in case if expected event does not happen.
---
 .../org/apache/catalina/core/TestAsyncContextStateChanges.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
index b9fce86..9c7e723 100644
--- a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
+++ b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.servlet.AsyncContext;
@@ -125,11 +126,10 @@ public class TestAsyncContextStateChanges extends TomcatBaseTest {
         if (asyncEnd.isError()) {
             client.disconnect();
             closeLatch.countDown();
-            try {
-                endLatch.await();
-            } catch (InterruptedException e) {
-                // Ignore
-            }
+
+            Assert.assertTrue(
+                    "Awaiting endLatch did not complete in 10 seconds",
+                    endLatch.await(10, TimeUnit.SECONDS));
         } else {
             client.setUseContentLength(true);
             client.readResponse(true);


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


Re: [tomcat] branch 7.0.x updated: BZ 63950 - Limit wait time in a test case.

Posted by Konstantin Kolinko <kn...@gmail.com>.
сб, 23 нояб. 2019 г. в 23:03, Michael Osipov <mi...@apache.org>:
>
> Am 2019-11-23 um 20:57 schrieb kkolinko@apache.org:
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > kkolinko 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 858f7e7  BZ 63950 - Limit wait time in a test case.
> > 858f7e7 is described below
> >
> > commit 858f7e7d3d367f4654a95aa31f0ebf57185e12cc
> > Author: Konstantin Kolinko <kk...@apache.org>
> > AuthorDate: Sat Nov 23 21:05:50 2019 +0300
> >
> >      BZ 63950 - Limit wait time in a test case.
> >
> >      Limit waiting time for endLatch of TestAsyncContextStateChanges#testAsync(),
> >      so that the test does not hang indefinitely in case if expected event does not happen.
> > ---
> >   .../org/apache/catalina/core/TestAsyncContextStateChanges.java | 10 +++++-----
> >   1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
> > index b9fce86..9c7e723 100644
> > --- a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
> > +++ b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
> > @@ -22,6 +22,7 @@ import java.util.ArrayList;
> >   import java.util.Collection;
> >   import java.util.List;
> >   import java.util.concurrent.CountDownLatch;
> > +import java.util.concurrent.TimeUnit;
> >   import java.util.concurrent.atomic.AtomicBoolean;
> >
> >   import javax.servlet.AsyncContext;
> > @@ -125,11 +126,10 @@ public class TestAsyncContextStateChanges extends TomcatBaseTest {
> >           if (asyncEnd.isError()) {
> >               client.disconnect();
> >               closeLatch.countDown();
> > -            try {
> > -                endLatch.await();
> > -            } catch (InterruptedException e) {
> > -                // Ignore
> > -            }
> > +
> > +            Assert.assertTrue(
> > +                    "Awaiting endLatch did not complete in 10 seconds",
> > +                    endLatch.await(10, TimeUnit.SECONDS));
> >           } else {
> >               client.setUseContentLength(true);
> >               client.readResponse(true);
>
> Doe this fix the issue or the symptom?

It improves handling of the failure. The issue itself is not fixed.

It makes the test fail instead of hanging the CI server and allows
subsequent tests to run.

Best regards,
Konstantin Kolinko

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


Re: [tomcat] branch 7.0.x updated: BZ 63950 - Limit wait time in a test case.

Posted by Michael Osipov <mi...@apache.org>.
Am 2019-11-23 um 20:57 schrieb kkolinko@apache.org:
> This is an automated email from the ASF dual-hosted git repository.
> 
> kkolinko 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 858f7e7  BZ 63950 - Limit wait time in a test case.
> 858f7e7 is described below
> 
> commit 858f7e7d3d367f4654a95aa31f0ebf57185e12cc
> Author: Konstantin Kolinko <kk...@apache.org>
> AuthorDate: Sat Nov 23 21:05:50 2019 +0300
> 
>      BZ 63950 - Limit wait time in a test case.
>      
>      Limit waiting time for endLatch of TestAsyncContextStateChanges#testAsync(),
>      so that the test does not hang indefinitely in case if expected event does not happen.
> ---
>   .../org/apache/catalina/core/TestAsyncContextStateChanges.java | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
> index b9fce86..9c7e723 100644
> --- a/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
> +++ b/test/org/apache/catalina/core/TestAsyncContextStateChanges.java
> @@ -22,6 +22,7 @@ import java.util.ArrayList;
>   import java.util.Collection;
>   import java.util.List;
>   import java.util.concurrent.CountDownLatch;
> +import java.util.concurrent.TimeUnit;
>   import java.util.concurrent.atomic.AtomicBoolean;
>   
>   import javax.servlet.AsyncContext;
> @@ -125,11 +126,10 @@ public class TestAsyncContextStateChanges extends TomcatBaseTest {
>           if (asyncEnd.isError()) {
>               client.disconnect();
>               closeLatch.countDown();
> -            try {
> -                endLatch.await();
> -            } catch (InterruptedException e) {
> -                // Ignore
> -            }
> +
> +            Assert.assertTrue(
> +                    "Awaiting endLatch did not complete in 10 seconds",
> +                    endLatch.await(10, TimeUnit.SECONDS));
>           } else {
>               client.setUseContentLength(true);
>               client.readResponse(true);

Doe this fix the issue or the symptom?

Michael

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