FlowPlatformTest race condition

13 views
Skip to first unread message

pankit thapar

unread,
Apr 12, 2014, 11:38:39 AM4/12/14
to cascadi...@googlegroups.com
Hi,

I ran the compatibility suite and one of the tests : FlowPlatformTest:testStop failed.
cascading.flow.hadoop.FlowPlatformTest > testStop FAILED
    junit.framework.AssertionFailedError at FlowPlatformTest.java:238

Code Snippet : 

final Semaphore start = new Semaphore( 0 );

    final long startTime = System.nanoTime();


    Future<Long> future = newSingleThreadExecutor().submit( new Callable<Long>()

    {

    @Override

    public Long call() throws Exception

      {

      start.release();

      LOG.info( "calling complete" );

      flow.complete();

      return System.nanoTime() - startTime;

      }

    } );


    start.acquire();

    LOG.info( "calling stop" );

    flow.stop();


    long stopTime = System.nanoTime() - startTime;

    long completeTime = future.get();


    assertTrue( String.format( "stop: %s complete: %s", stopTime, completeTime ), stopTime <= completeTime );



The assertion in last line fails. As far as I can understand, this means that there was some race condition involved.

According to a comment above the test case, the race condition only occurs when executing in local mode.

Is it possible that the race condition also happens if there is only one machine in the cluster?


Thanks,

Pankit

Andre Kelpe

unread,
Apr 22, 2014, 5:05:26 AM4/22/14
to cascadi...@googlegroups.com
Hi Pankit,

the test as it stands is not bullet proof and we have to rethink it.
The problem is that we try to guarantee a certain timing, which we
really cannot. The thing is, that for instance a plugin like driven
might do a network call when stop() or complete() is called and that
can have an influence on timings.

If this is the only failing tests in the compat suite, you should be good to go.

- André

On 4/12/14, pankit thapar <thapar...@gmail.com> wrote:
> Hi,
>
> I ran the compatibility suite and one of the tests :
> FlowPlatformTest:testStop failed.
>
> cascading.flow.hadoop.FlowPlatformTest > testStop FAILED
> junit.framework.AssertionFailedError at FlowPlatformTest.java:238
>
>
> Code Snippet :
>
> final Semaphore start = new Semaphore( 0 );
>
> final long startTime = System.nanoTime();
>
>
> Future<Long> future = newSingleThreadExecutor().submit( new
> Callable<Long>()
>
> {
>
> @Override
>
> public Long call() throws Exception
>
> {
>
> start.release();
>
> LOG.info( "calling complete" );
>
> flow.complete();
>
> return System.nanoTime() - startTime;
>
> }
>
> } );
>
>
> start.acquire();
>
> LOG.info( "calling stop" );
>
> flow.stop();
>
>
> long stopTime = System.nanoTime() - startTime;
>
> long completeTime = future.get();
>
>
> * assertTrue( String.format( "stop: %s complete: %s", stopTime,
> completeTime ), stopTime <= completeTime );*
>
>
>
> The assertion in last line fails. As far as I can understand, this means
> that there was some race condition involved.
>
> According to a comment above the test case, the race condition only occurs
> when executing in local mode.
>
> Is it possible that the race condition also happens if there is only one
> machine in the cluster?
>
>
> Thanks,
>
> Pankit
>
> --
> You received this message because you are subscribed to the Google Groups
> "cascading-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cascading-use...@googlegroups.com.
> To post to this group, send email to cascadi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cascading-user.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cascading-user/d15b0ec8-2c18-431d-8a67-f6dc9f046caf%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


--
André Kelpe
an...@concurrentinc.com
http://concurrentinc.com
Reply all
Reply to author
Forward
0 new messages