[ 
https://issues.apache.org/jira/browse/APEXMALHAR-2544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16233820#comment-16233820
 ] 

ASF GitHub Bot commented on APEXMALHAR-2544:
--------------------------------------------

ananthc closed pull request #677: APEXMALHAR-2544 Flume test synchronization 
bug.
URL: https://github.com/apache/apex-malhar/pull/677
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/flume/src/test/java/org/apache/apex/malhar/flume/sink/FlumeSinkTest.java 
b/flume/src/test/java/org/apache/apex/malhar/flume/sink/FlumeSinkTest.java
index e7007cba8c..d9d51ec68e 100644
--- a/flume/src/test/java/org/apache/apex/malhar/flume/sink/FlumeSinkTest.java
+++ b/flume/src/test/java/org/apache/apex/malhar/flume/sink/FlumeSinkTest.java
@@ -23,6 +23,8 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -49,28 +51,23 @@
   @SuppressWarnings("SleepWhileInLoop")
   public void testServer() throws InterruptedException, IOException
   {
+    final CountDownLatch countdown = new CountDownLatch(1);
     Discovery<byte[]> discovery = new Discovery<byte[]>()
     {
       @Override
-      public synchronized void unadvertise(Service<byte[]> service)
+      public void unadvertise(Service<byte[]> service)
       {
         logger.info("Unadvertise invoked");
-        notify();
+        countdown.countDown();
       }
 
       @Override
-      public synchronized void advertise(Service<byte[]> service)
+      public void advertise(Service<byte[]> service)
       {
         logger.info("Advertise invoked");
-        // There is a race condition that is breaking the test (Advertise 
invoked before discover started, hence sleep
-        try {
-          Thread.sleep(1000);
-        } catch (InterruptedException e) {
-          logger.warn("Not able to sleep because of interruption " + 
e.getMessage(),e);
-        }
         port = service.getPort();
         logger.debug("listening at {}", service);
-        notify();
+        countdown.countDown();
       }
 
       @Override
@@ -79,7 +76,7 @@ public synchronized void advertise(Service<byte[]> service)
       {
         logger.info("Discover invoked");
         try {
-          wait();
+          countdown.await(30, TimeUnit.SECONDS);
           logger.info("Discover wait completed");
         } catch (InterruptedException ie) {
           throw new RuntimeException(ie);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Flume test leads to Travis timeout
> ----------------------------------
>
>                 Key: APEXMALHAR-2544
>                 URL: https://issues.apache.org/jira/browse/APEXMALHAR-2544
>             Project: Apache Apex Malhar
>          Issue Type: Bug
>            Reporter: Thomas Weise
>            Priority: Major
>
> Seen in two subsequent instances.
> https://travis-ci.org/apache/apex-malhar/pull_requests
> {code}
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m
> Running org.apache.apex.malhar.flume.sink.ServerTest
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.08 sec - in 
> org.apache.apex.malhar.flume.sink.ServerTest
> Running org.apache.apex.malhar.flume.sink.FlumeSinkTest
> No output has been received in the last 10m0s, this potentially indicates a 
> stalled build or something wrong with the build itself.
> Check the details on how to adjust your build configuration on: 
> https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
> The build has been terminated
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to