Hi Rik,
If you build fresh clang from sources following the instructions:
https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild
Then, you can apply the following patch to tsan runtime, then tsan
will dump locked mutexes on the CHECK failure. This will allow us to
understand why the thread holds that many mutexes at once. You say
that only 16 mutexes are locked, but tsan thinks that it is 64. We
will understand why tsan thinks so.
Index: sanitizer_common/sanitizer_deadlock_detector.h
===================================================================
--- sanitizer_common/sanitizer_deadlock_detector.h (revision 245715)
+++ sanitizer_common/sanitizer_deadlock_detector.h (working copy)
@@ -28,6 +28,7 @@
#include "sanitizer_common.h"
#include "sanitizer_bvgraph.h"
+#include "sanitizer_stackdepot.h"
namespace __sanitizer {
@@ -66,7 +67,13 @@
recursive_locks[n_recursive_locks++] = lock_id;
return false;
}
- CHECK_LT(n_all_locks_, ARRAY_SIZE(all_locks_with_contexts_));
+ if (n_all_locks_ >= ARRAY_SIZE(all_locks_with_contexts_)) {
+ Printf("Current thread holds too many mutexes\n");
+ for (int i = 0; i < ARRAY_SIZE(all_locks_with_contexts_); i++) {
+ StackDepotGet(all_locks_with_contexts_[i].stk).Print();
+ }
+ CHECK(0);
+ }
// lock_id < BV::kSize, can cast to a smaller int.
u32 lock_id_short = static_cast<u32>(lock_id);
LockWithContext l = {lock_id_short, stk};
Index: sanitizer_common/sanitizer_deadlock_detector1.cc
===================================================================
--- sanitizer_common/sanitizer_deadlock_detector1.cc (revision 245715)
+++ sanitizer_common/sanitizer_deadlock_detector1.cc (working copy)
@@ -148,7 +148,7 @@
void DD::MutexAfterLock(DDCallback *cb, DDMutex *m, bool wlock, bool trylock) {
DDLogicalThread *lt = cb->lt;
u32 stk = 0;
- if (flags.second_deadlock_stack)
+ //if (flags.second_deadlock_stack)
stk = cb->Unwind();
// Printf("T%p MutexLock: %zx stk %u\n", lt, m->id, stk);
if (dd.onFirstLock(<->dd, m->id, stk))
> --
> You received this message because you are subscribed to the Google Groups
> "thread-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
thread-sanitiz...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.