Skip to content

Commit 1d61bf3

Browse files
abhinavdangetichiyoung
authored andcommitted
MB-19276: Fix data race on ExecutorThread::taskStart
WARNING: ThreadSanitizer: data race (pid=236996) Write of size 8 at 0x7d380000dbd8 by thread T5: #0 ExecutorThread::run() ep-engine/src/executorthread.cc:105 (ep.so+0x0000000ee0cc) #1 launch_executor_thread(void*) ep-engine/src/executorthread.cc:33 (ep.so+0x0000000edd75) #2 platform_thread_wrap(void*) platform/src/cb_pthreads.cc:54 (libplatform.so.0.1.0+0x000000004e7b) Previous read of size 8 at 0x7d380000dbd8 by main thread (mutexes: write M266835151185571736): #0 addWorkerStats(char const*, ExecutorThread*, void const*, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) ep-engine/src/executorthread.h:108 (ep.so+0x0000000ea8dc) #1 EventuallyPersistentEngine::getStats(void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) ep-engine/src/ep_engine.cc:4363 (ep.so+0x0000000c05dd) #2 EvpGetStats(engine_interface*, void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) ep-engine/src/ep_engine.cc:219 (ep.so+0x0000000af40e) #3 mock_get_stats(engine_interface*, void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) memcached/programs/engine_testapp/engine_testapp.cc:240 (engine_testapp+0x0000004cc71d) #4 test_worker_stats(engine_interface*, engine_interface_v1*) ep-engine/tests/ep_testsuite.cc:9464 (ep_testsuite.so+0x00000003c038) #5 execute_test(test, char const*, char const*) memcached/programs/engine_testapp/engine_testapp.cc:1091 (engine_testapp+0x0000004cb315) #6 __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 (libc.so.6+0x00000002176c) Change-Id: If01aba3cf6b3591f19c5bb62119e40998f12c8ff Reviewed-on: http://review.couchbase.org/63028 Well-Formed: buildbot <[email protected]> Reviewed-by: Jim Walker <[email protected]> Reviewed-by: Will Gardner <[email protected]> Tested-by: buildbot <[email protected]>
1 parent ac9a437 commit 1d61bf3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/executorthread.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <utility>
2828
#include <vector>
2929

30+
#include <relaxed_atomic.h>
31+
3032
#include "atomic.h"
3133
#include "common.h"
3234
#include "mutex.h"
@@ -132,7 +134,7 @@ class ExecutorThread {
132134
AtomicValue<hrtime_t> now; // record of current time
133135
hrtime_t waketime; // set to the earliest
134136

135-
hrtime_t taskStart;
137+
Couchbase::RelaxedAtomic<hrtime_t> taskStart;
136138

137139
Mutex currentTaskMutex; // Protects currentTask
138140
ExTask currentTask;

0 commit comments

Comments
 (0)