drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Rogers (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-5676) TestCountDownLatchInjection.latchInjected contains race conditions
Date Tue, 18 Jul 2017 20:31:00 GMT
Paul Rogers created DRILL-5676:

             Summary: TestCountDownLatchInjection.latchInjected contains race conditions
                 Key: DRILL-5676
                 URL: https://issues.apache.org/jira/browse/DRILL-5676
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.10.0
            Reporter: Paul Rogers

Consider the unit test {{TestCountDownLatchInjection.latchInjected}}. This test sets up a
multi-threaded test case to test a latch mechanism. But, the test code contains race conditions.
The code first starts a bunch of threads that use the latch, then initializes the latch.

Proper logic would initialize the latch, then launch the threads.

As a result of the race condition, the test randomly fails. Developers spend much time tracking
down each failure to be sure that it is just random. Let's just fix this test and be done
with it.


    // Start the threads that will trigger the count downs on the latch
    (new ThreadCreator(dummyClass, trigger, threads, countingDownTime)).start();
    final long timeSpentWaiting;
    try {
      // Initialize the latch and wait for count downs
      timeSpentWaiting = dummyClass.initAndWait();

This message was sent by Atlassian JIRA

View raw message