You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2017/01/20 05:19:53 UTC

kudu git commit: thirdparty: patch glog for better breakpad support

Repository: kudu
Updated Branches:
  refs/heads/master 6c90e5dae -> e8381bb44


thirdparty: patch glog for better breakpad support

This patch is a backport of glog commit
cda16b3443e2d6ef88cdbbe10b9a11adea6f33fe which was committed after the
latest release (0.3.4).

Subject: Reset SIGABRT action only if FailureSignalHandler is installed.

Without this patch applied, CHECK() failures will not generate a
minidump. With the patch, CHECK() first displays a stack trace and then
generates a minidump.

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


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

Branch: refs/heads/master
Commit: e8381bb4433df84c3b0994e2e269ce073a94c874
Parents: 6c90e5d
Author: Mike Percy <mp...@apache.org>
Authored: Wed Jan 11 22:48:49 2017 -0800
Committer: Mike Percy <mp...@apache.org>
Committed: Fri Jan 20 05:19:42 2017 +0000

----------------------------------------------------------------------
 thirdparty/download-thirdparty.sh               |  3 +-
 ...a16b3443e2d6ef88cdbbe10b9a11adea6f33fe.patch | 94 ++++++++++++++++++++
 2 files changed, 96 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/e8381bb4/thirdparty/download-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh
index 9b8c8ce..c5c0b16 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -102,7 +102,7 @@ fetch_and_expand() {
 mkdir -p $TP_SOURCE_DIR
 cd $TP_SOURCE_DIR
 
-GLOG_PATCHLEVEL=2
+GLOG_PATCHLEVEL=3
 delete_if_wrong_patchlevel $GLOG_SOURCE $GLOG_PATCHLEVEL
 if [ ! -d $GLOG_SOURCE ]; then
   fetch_and_expand glog-${GLOG_VERSION}.tar.gz
@@ -110,6 +110,7 @@ if [ ! -d $GLOG_SOURCE ]; then
   pushd $GLOG_SOURCE
   patch -p0 < $TP_DIR/patches/glog-issue-198-fix-unused-warnings.patch
   patch -p0 < $TP_DIR/patches/glog-issue-54-dont-build-tests.patch
+  patch -p1 < $TP_DIR/patches/glog-cda16b3443e2d6ef88cdbbe10b9a11adea6f33fe.patch
   touch patchlevel-$GLOG_PATCHLEVEL
   autoreconf -fvi
   popd

http://git-wip-us.apache.org/repos/asf/kudu/blob/e8381bb4/thirdparty/patches/glog-cda16b3443e2d6ef88cdbbe10b9a11adea6f33fe.patch
----------------------------------------------------------------------
diff --git a/thirdparty/patches/glog-cda16b3443e2d6ef88cdbbe10b9a11adea6f33fe.patch b/thirdparty/patches/glog-cda16b3443e2d6ef88cdbbe10b9a11adea6f33fe.patch
new file mode 100644
index 0000000..e1900bb
--- /dev/null
+++ b/thirdparty/patches/glog-cda16b3443e2d6ef88cdbbe10b9a11adea6f33fe.patch
@@ -0,0 +1,94 @@
+commit cda16b3443e2d6ef88cdbbe10b9a11adea6f33fe
+Author: Yoshisato Yanagisawa <yy...@google.com>
+Date:   Wed Nov 18 15:40:12 2015 +0900
+
+    Reset SIGABRT action only if FailureSignalHandler is installed.
+    
+    When I set my own signal handler to SIGABRT, it did not executed
+    with CHECK.  That is because SIGABRT handler is reset to default
+    just before glog calls abort.
+    Let me make it reset only if the handler is what glog installed
+    i.e. FailureSignalHandler.
+
+diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in
+index 455bd28..b1de2c9 100644
+--- a/src/glog/logging.h.in
++++ b/src/glog/logging.h.in
+@@ -923,6 +923,9 @@ template <bool>
+ struct CompileAssert {
+ };
+ struct CrashReason;
++
++// Returns true if FailureSignalHandler is installed.
++bool IsFailureSignalHandlerInstalled();
+ }  // namespace glog_internal_namespace_
+ 
+ #define GOOGLE_GLOG_COMPILE_ASSERT(expr, msg) \
+diff --git a/src/signalhandler.cc b/src/signalhandler.cc
+index cccd800..a7aef8b 100644
+--- a/src/signalhandler.cc
++++ b/src/signalhandler.cc
+@@ -335,6 +335,22 @@ void FailureSignalHandler(int signal_number,
+ 
+ #endif  // HAVE_SIGACTION
+ 
++namespace glog_internal_namespace_ {
++
++bool IsFailureSignalHandlerInstalled() {
++#ifdef HAVE_SIGACTION
++  struct sigaction sig_action;
++  memset(&sig_action, 0, sizeof(sig_action));
++  sigemptyset(&sig_action.sa_mask);
++  sigaction(SIGABRT, NULL, &sig_action);
++  if (sig_action.sa_sigaction == &FailureSignalHandler)
++    return true;
++#endif  // HAVE_SIGACTION
++  return false;
++}
++
++}  // namespace glog_internal_namespace_
++
+ void InstallFailureSignalHandler() {
+ #ifdef HAVE_SIGACTION
+   // Build the sigaction struct.
+diff --git a/src/utilities.cc b/src/utilities.cc
+index f31c7c7..5c88e58 100644
+--- a/src/utilities.cc
++++ b/src/utilities.cc
+@@ -138,13 +138,15 @@ static void DumpStackTraceAndExit() {
+ 
+   // TOOD(hamaji): Use signal instead of sigaction?
+ #ifdef HAVE_SIGACTION
+-  // Set the default signal handler for SIGABRT, to avoid invoking our
+-  // own signal handler installed by InstallFailedSignalHandler().
+-  struct sigaction sig_action;
+-  memset(&sig_action, 0, sizeof(sig_action));
+-  sigemptyset(&sig_action.sa_mask);
+-  sig_action.sa_handler = SIG_DFL;
+-  sigaction(SIGABRT, &sig_action, NULL);
++  if (IsFailureSignalHandlerInstalled()) {
++    // Set the default signal handler for SIGABRT, to avoid invoking our
++    // own signal handler installed by InstallFailureSignalHandler().
++    struct sigaction sig_action;
++    memset(&sig_action, 0, sizeof(sig_action));
++    sigemptyset(&sig_action.sa_mask);
++    sig_action.sa_handler = SIG_DFL;
++    sigaction(SIGABRT, &sig_action, NULL);
++  }
+ #endif  // HAVE_SIGACTION
+ 
+   abort();
+diff --git a/src/windows/glog/logging.h b/src/windows/glog/logging.h
+index bab8c61..36107a6 100755
+--- a/src/windows/glog/logging.h
++++ b/src/windows/glog/logging.h
+@@ -910,6 +910,9 @@ template <bool>
+ struct CompileAssert {
+ };
+ struct CrashReason;
++
++// Returns true if FailureSignalHandler is installed.
++bool IsFailureSignalHandlerInstalled();
+ }  // namespace glog_internal_namespace_
+ 
+ #define GOOGLE_GLOG_COMPILE_ASSERT(expr, msg) \