ThreadSanitizer has identified a potential deadlock due to a cycle in
the lock order graph: Cycle in lock order graph:
M43515 => M36787 => M36848 => M43515
[ActiveStream:: [TaskQueue:: [ExecutorThread:: [ActiveStream::
streamMutex] mutex] currentTaskMutex] streamMutex]
The crux of the problem appears to be the acquisition of streamMutex
in the destructor of ActiveStream. This is ultimately a Bad Idea - if
you still have multiple threads accessing an object when it's been
deleted then you are already into undefined behaviour.
Change-Id: I2353b5a8ed93a4f9e8cc036cb85680c185cbcc2f
Reviewed-on: http://review.couchbase.org/63033
Well-Formed: buildbot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
uint64_t snap_end_seqno);
~ActiveStream() {
- LockHolder lh(streamMutex);
transitionState(STREAM_DEAD);
clear_UNLOCKED();
}