Skip to content

Commit 6387cef

Browse files
abhinavdangetichiyoung
authored andcommitted
MB-19277: Set executorThread's waketime to atomic
This one looks benign - we only perform the dirty read when calculating the %s:waketime stat which is not used by anyone apart from end-users. WARNING: ThreadSanitizer: data race (pid=41666) Read of size 8 at 0x7d4400008370 by main thread (mutexes: write M21616): #0 ExecutorThread::getWaketime() ep-engine/src/executorthread.h:120 (ep.so+0x0000001cac0e) #1 addWorkerStats(char const*, ExecutorThread*, void const*, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) ep-engine/src/executorpool.cc:692 (ep.so+0x0000001b6f06) #2 ExecutorPool::doWorkerStat(EventuallyPersistentEngine*, void const*, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) ep-engine/src/executorpool.cc:706 (ep.so+0x0000001b6734) #3 EventuallyPersistentEngine::doDispatcherStats(void const*, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) ep-engine/src/ep_engine.cc:4139 (ep.so+0x00000015223e) #4 EventuallyPersistentEngine::getStats(void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) ep-engine/src/ep_engine.cc:4375 (ep.so+0x000000155336) Previous write of size 8 at 0x7d4400008370 by thread T6 (mutexes: write M14985): #0 TaskQueue::_fetchNextTask(ExecutorThread&, bool) ep-engine/src/taskqueue.cc:125 (ep.so+0x00000025b3fd) #1 TaskQueue::fetchNextTask(ExecutorThread&, bool) ep-engine/src/taskqueue.cc:161 (ep.so+0x00000025bfcf) #2 ExecutorPool::_nextTask(ExecutorThread&, unsigned char) ep-engine/src/executorpool.cc:217 (ep.so+0x0000001afc67) #3 ExecutorPool::nextTask(ExecutorThread&, unsigned char) ep-engine/src/executorpool.cc:232 (ep.so+0x0000001afe3f) #4 ExecutorThread::run() ep-engine/src/executorthread.cc:81 (ep.so+0x0000001e85c9) Change-Id: I34b12681dd9dfc87c889f301692ca714f04d2a82 Reviewed-on: http://review.couchbase.org/63029 Well-Formed: buildbot <[email protected]> Reviewed-by: Jim Walker <[email protected]> Reviewed-by: Will Gardner <[email protected]> Tested-by: buildbot <[email protected]>
1 parent 1d61bf3 commit 6387cef

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/executorthread.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void ExecutorThread::run() {
142142
currentTask->getDescription().c_str(),
143143
currentTask->getId(), new_waketime,
144144
currentTask->getWaketime(),
145-
waketime);
145+
waketime.load());
146146
}
147147
} catch (std::exception& e) {
148148
LOG(EXTENSION_LOG_WARNING,

src/executorthread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class ExecutorThread {
132132
AtomicValue<executor_state_t> state;
133133

134134
AtomicValue<hrtime_t> now; // record of current time
135-
hrtime_t waketime; // set to the earliest
135+
AtomicValue<hrtime_t> waketime; // set to the earliest
136136

137137
Couchbase::RelaxedAtomic<hrtime_t> taskStart;
138138

0 commit comments

Comments
 (0)