You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/07/01 18:53:45 UTC

[2/2] incubator-kudu git commit: Try again to disable core dumps in some tests

Try again to disable core dumps in some tests

133767185047987e1d7f768d09db950dc8e38897 attempted to disable core
dumps in some tests by adding a --disable_core_dumps flag. However,
I had put the handling of this flag in the InitKuduOrDie() function,
which actually is called prior to flags being parsed, so the flag
didn't work as intended.

I noticed that the fix was ineffectual because the tests that were
supposed to be de-flaked by it remained flaky. After setting up
a VM which matched the test environment I noticed that they were
still flaky due to core dumps, and figured out this issue.

The fix is just to move the DisableCoreDumps() call to the spot
where we parse flags.

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


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

Branch: refs/heads/master
Commit: 1ebfa6c6632674b20e13d6ef125d07c459a73d61
Parents: c7ecdf0
Author: Todd Lipcon <to...@apache.org>
Authored: Thu Jun 30 18:35:32 2016 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Fri Jul 1 18:53:30 2016 +0000

----------------------------------------------------------------------
 src/kudu/util/flags.cc |  9 +++++++++
 src/kudu/util/init.cc  | 13 ++-----------
 2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/1ebfa6c6/src/kudu/util/flags.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/flags.cc b/src/kudu/util/flags.cc
index 17e6ee5..1887f9e 100644
--- a/src/kudu/util/flags.cc
+++ b/src/kudu/util/flags.cc
@@ -29,6 +29,7 @@
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/metrics.h"
+#include "kudu/util/os-util.h"
 #include "kudu/util/path_util.h"
 #include "kudu/util/url-coding.h"
 #include "kudu/util/version_info.h"
@@ -58,6 +59,10 @@ DEFINE_string(heap_profile_path, "", "Output path to store heap profiles. If not
 TAG_FLAG(heap_profile_path, stable);
 TAG_FLAG(heap_profile_path, advanced);
 
+DEFINE_bool(disable_core_dumps, false, "Disable core dumps when this process crashes.");
+TAG_FLAG(disable_core_dumps, advanced);
+TAG_FLAG(disable_core_dumps, evolving);
+
 // Tag a bunch of the flags that we inherit from glog/gflags.
 
 //------------------------------------------------------------
@@ -275,6 +280,10 @@ int ParseCommandLineFlags(int* argc, char*** argv, bool remove_flags) {
         "/tmp/$0.$1", google::ProgramInvocationShortName(), getpid());
   }
 
+  if (FLAGS_disable_core_dumps) {
+    DisableCoreDumps();
+  }
+
 #ifdef TCMALLOC_ENABLED
   if (FLAGS_enable_process_lifetime_heap_profiling) {
     HeapProfilerStart(FLAGS_heap_profile_path.c_str());

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/1ebfa6c6/src/kudu/util/init.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/init.cc b/src/kudu/util/init.cc
index 58c9baa..fa55b05 100644
--- a/src/kudu/util/init.cc
+++ b/src/kudu/util/init.cc
@@ -17,21 +17,14 @@
 
 #include "kudu/util/init.h"
 
-#include <gflags/gflags.h>
 #include <string>
 
 #include "kudu/gutil/cpu.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/util/flag_tags.h"
-#include "kudu/util/os-util.h"
 #include "kudu/util/status.h"
 
 using std::string;
 
-DEFINE_bool(disable_core_dumps, false, "Disable core dumps when this process crashes.");
-TAG_FLAG(disable_core_dumps, advanced);
-TAG_FLAG(disable_core_dumps, evolving);
-
 namespace kudu {
 
 Status BadCPUStatus(const base::CPU& cpu, const char* instruction_set) {
@@ -57,10 +50,8 @@ Status CheckCPUFlags() {
 
 void InitKuduOrDie() {
   CHECK_OK(CheckCPUFlags());
-
-  if (FLAGS_disable_core_dumps) {
-    DisableCoreDumps();
-  }
+  // NOTE: this function is called before flags are parsed.
+  // Do not add anything in here which is flag-dependent.
 }
 
 } // namespace kudu