Repository: kudu
Updated Branches:
  refs/heads/master 68c185747 -> 4cd6338e6


KUDU-2336. diagnostics_log: fix an assertion failure for null stack frames

On my Ubuntu 16 box, in ASAN builds, it seems I sometimes get a stack
frame with a nullptr address. This caused SymbolSet::Add(...) to fail an
assertion since it uses google::dense_hash_set<> which requires that
there be one key reserved as a non-insertable "empty" marker. We were
using nullptr for that but not checking before potentially inserting it.

This adds a simple workaround. Without the patch, if I started a tserver
with --diagnostics-log-stack-traces-interval-ms=10, it would crash about
10% of the time with the following assertion failure:

kudu-master: 
../../thirdparty/installed/common/include/sparsehash/internal/densehashtable.h:969:
  std::pair<iterator, bool> google::dense_hashtable<...>...:
  Assertion `!equals(std::forward<K>(key), key_info.empty_key) && "Inserting 
the empty key"' failed.

Change-Id: I73ada54bef056b665c03ca142a3995ae6ad59230
Reviewed-on: http://gerrit.cloudera.org:8080/9591
Tested-by: Todd Lipcon <t...@apache.org>
Reviewed-by: Alexey Serbin <aser...@cloudera.com>


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

Branch: refs/heads/master
Commit: 4cd6338e60101b7c442ee7f8c28215ea3558cbf1
Parents: 68c1857
Author: Todd Lipcon <t...@apache.org>
Authored: Mon Mar 12 15:41:57 2018 -0700
Committer: Todd Lipcon <t...@apache.org>
Committed: Tue Mar 13 01:39:24 2018 +0000

----------------------------------------------------------------------
 src/kudu/server/diagnostics_log.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/4cd6338e/src/kudu/server/diagnostics_log.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/diagnostics_log.cc 
b/src/kudu/server/diagnostics_log.cc
index a185bd2..179b502 100644
--- a/src/kudu/server/diagnostics_log.cc
+++ b/src/kudu/server/diagnostics_log.cc
@@ -89,7 +89,10 @@ class DiagnosticsLog::SymbolSet {
 
   // Return true if the addr was added, false if it already existed.
   bool Add(void* addr) {
-    return InsertIfNotPresent(&set_, addr);
+    // We can't add nullptr since that's the 'empty' key. However this
+    // also will never have a real symbol, so we'll just pretend it's already
+    // present.
+    return addr && InsertIfNotPresent(&set_, addr);
   }
 
   void ResetIfLogRolled(int roll_count) {

Reply via email to