kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [1/2] kudu git commit: Make threadpool-test less flaky
Date Thu, 01 Dec 2016 02:00:34 GMT
Repository: kudu
Updated Branches:
  refs/heads/master b39491de6 -> c52cc1630


Make threadpool-test less flaky

Under heavy load, threadpool-test may take more than 10 seconds in rare
cases and cause a test failure. This change increases the timeout.

Also reliably disable the alarm, even if an assertion fires, using a
ScopedCleanup object.

Change-Id: I6465922e5b43dc9aff80fa2b6e6549061bfd0425
Reviewed-on: http://gerrit.cloudera.org:8080/5293
Reviewed-by: Adar Dembo <adar@cloudera.com>
Reviewed-by: Todd Lipcon <todd@apache.org>
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/730bae3b
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/730bae3b
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/730bae3b

Branch: refs/heads/master
Commit: 730bae3b5828875dab818eac191f526ec61b6424
Parents: b39491d
Author: Mike Percy <mpercy@apache.org>
Authored: Wed Nov 30 23:04:45 2016 +0000
Committer: Todd Lipcon <todd@apache.org>
Committed: Thu Dec 1 01:48:19 2016 +0000

----------------------------------------------------------------------
 src/kudu/util/threadpool-test.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/730bae3b/src/kudu/util/threadpool-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/threadpool-test.cc b/src/kudu/util/threadpool-test.cc
index b6bcd55..2f8e2fa 100644
--- a/src/kudu/util/threadpool-test.cc
+++ b/src/kudu/util/threadpool-test.cc
@@ -25,6 +25,7 @@
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/metrics.h"
 #include "kudu/util/promise.h"
+#include "kudu/util/scoped_cleanup.h"
 #include "kudu/util/threadpool.h"
 #include "kudu/util/test_macros.h"
 #include "kudu/util/trace.h"
@@ -161,7 +162,10 @@ TEST(TestThreadPool, TestThreadPoolWithNoMinimum) {
 // Regression test for a bug where a task is submitted exactly
 // as a thread is about to exit. Previously this could hang forever.
 TEST(TestThreadPool, TestRace) {
-  alarm(10);
+  alarm(60);
+  auto cleanup = MakeScopedCleanup([]() {
+    alarm(0); // Disable alarm on test exit.
+  });
   MonoDelta idle_timeout = MonoDelta::FromMicroseconds(1);
   gscoped_ptr<ThreadPool> thread_pool;
   ASSERT_OK(ThreadPoolBuilder("test")
@@ -176,7 +180,6 @@ TEST(TestThreadPool, TestRace) {
     // the bug.
     SleepFor(MonoDelta::FromMicroseconds(i));
   }
-  alarm(0);
 }
 
 TEST(TestThreadPool, TestVariableSizeThreadPool) {


Mime
View raw message