Hello Adar Dembo,

I'd like you to do a code review.  Please visit

    http://gerrit.cloudera.org:8080/5741

to review the following change.

Change subject: Control mutex stack walking in DEBUG mode with a gflag
......................................................................

Control mutex stack walking in DEBUG mode with a gflag

In the case of a CHECK() failure, both the crashing thread and the
AsyncLogger thread may simultaneously attempt to symbolize their stacks.
AsyncLogger does this simply by acquiring a Mutex in RunThread(), which
triggers stack collection in DEBUG mode, while the crashing thread is
collecting the stack trace in order to print an important error message.

google::GetStackTrace() only allows access by one thread at a time. If
more than one thread attempts to invoke this function simultaneously,
there is a CAS that determines excluvisity. The "loser" of this contest
gets a short-circuit return along with a "0 length" stack trace,
indicating failure to collect the stack trace.

When the AsyncLogger thread wins this race against a CHECK-crashing
thread, the crashing thread ends up with an empty stack trace being
printed, which is detrimental to diagnosing the problem.

This patch disables the Mutex owner stack trace collection on DEBUG
builds by default, only enabling it when a hidden gflag is set.

Change-Id: Ie4593cf7173867ce2f6151e03df0be94f97d95d2
---
M src/kudu/util/mutex.cc
1 file changed, 16 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/41/5741/1
-- 
To view, visit http://gerrit.cloudera.org:8080/5741
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4593cf7173867ce2f6151e03df0be94f97d95d2
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>

Reply via email to