You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2017/09/01 21:55:42 UTC

kudu git commit: [periodic-test] fix flaky PeriodicTimerTest.TestReset

Repository: kudu
Updated Branches:
  refs/heads/master c8ad6668e -> 43833f939


[periodic-test] fix flaky PeriodicTimerTest.TestReset

Fixed flake in PeriodicTimerTest.TestReset. The test was a little bit
flaky because sometimes the main test thread might have slept for much
longer than requested, sometimes longer than the period of the task.
If that happened, the test failed with messages like the following:

  src/kudu/rpc/periodic-test.cc:116: Failure
        Expected: 0
  To be equal to: counter_
        Which is: 1

This fix just increases the period of the task across the board.

Prior to this fix, if running a DEBUG or ASAN build with
--stress-cpu-threads=64, there were about 2 failures every 1K run:
  http://dist-test.cloudera.org//job?job_id=aserbin.1504248200.5336

After the fix there are no failures anymore:
  http://dist-test.cloudera.org//job?job_id=aserbin.1504299298.23673

Change-Id: I6848bee0e830075aba3ae5d8ed49f99038043063
Reviewed-on: http://gerrit.cloudera.org:8080/7932
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/43833f93
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/43833f93
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/43833f93

Branch: refs/heads/master
Commit: 43833f939695734ce4d6370bc30f115d5006e2cd
Parents: c8ad666
Author: Alexey Serbin <as...@cloudera.com>
Authored: Fri Sep 1 13:52:04 2017 -0700
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Fri Sep 1 21:54:16 2017 +0000

----------------------------------------------------------------------
 src/kudu/rpc/periodic-test.cc | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/43833f93/src/kudu/rpc/periodic-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/periodic-test.cc b/src/kudu/rpc/periodic-test.cc
index b3fcaba..39e2e40 100644
--- a/src/kudu/rpc/periodic-test.cc
+++ b/src/kudu/rpc/periodic-test.cc
@@ -37,14 +37,15 @@ namespace rpc {
 class PeriodicTimerTest : public KuduTest,
                           public ::testing::WithParamInterface<double> {
  public:
+  // In TSAN builds it takes a long time to de-schedule a thread. Also,
+  // the actual time that thread spends sleeping in SleepFor() scenarios
+  // might be much longer than requested. Setting the task period to be long
+  // enough allows for more stable behavior of the test, so no flakiness
+  // is observed even under substantial load. Otherwise it would be necessary
+  // to introduce additional logic to verify that the actual timings satisfy
+  // the implicit constraints of the test scenarios below.
   PeriodicTimerTest()
-      :
-#ifdef THREAD_SANITIZER
-        // TSAN tends to deschedule threads for long periods of time.
-        period_ms_(200),
-#else
-        period_ms_(20),
-#endif
+      : period_ms_(200),
         counter_(0) {
   }