Skip to content

Commit 3da172a

Browse files
abhinavdangetichiyoung
authored andcommitted
MB-19256: Address possible data race on VBCBAdaptor::currentvb
WARNING: ThreadSanitizer: data race (pid=12312) Read of size 2 at 0x7d400000fff8 by main thread (mutexes: write M12542): #0 VBCBAdaptor::getDescription() /home/abhinav/couchbase/ep-engine/src/ep.h:128 (ep.so+0x0000000a7fe1) #1 ExecutorPool::_stopTaskGroup(unsigned long, task_type_t, bool) /home/abhinav/couchbase/ep-engine/src/executorpool.cc:562 (ep.so+0x0000000f3c21) #2 ExecutorPool::stopTaskGroup(unsigned long, task_type_t, bool) /home/abhinav/couchbase/ep-engine/src/executorpool.cc:585 (ep.so+0x0000000f3f5e) #3 ~EventuallyPersistentStore /home/abhinav/couchbase/ep-engine/src/ep.cc:468 (ep.so+0x0000000836c6) #4 ~EventuallyPersistentEngine /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:6326 (ep.so+0x0000000d4eda) #5 EvpDestroy(engine_interface*, bool) /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:141 (ep.so+0x0000000b4b8c) #6 mock_destroy(engine_interface*, bool) /home/abhinav/couchbase/memcached/programs/engine_testapp/engine_testapp.cc:98 (engine_testapp+0x0000000ba027) #7 destroy_bucket(engine_interface*, engine_interface_v1*, bool) /home/abhinav/couchbase/memcached/programs/engine_testapp/engine_testapp.cc:995 (engine_testapp+0x0000000b952e) #8 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 (libc.so.6+0x000000021ec4) Previous write of size 2 at 0x7d400000fff8 by thread T10: #0 VBCBAdaptor::run() /home/abhinav/couchbase/ep-engine/src/ep.cc:3776 (ep.so+0x00000009d7e3) #1 ExecutorThread::run() /home/abhinav/couchbase/ep-engine/src/executorthread.cc:112 (ep.so+0x0000000f94d3) #2 launch_executor_thread(void*) /home/abhinav/couchbase/ep-engine/src/executorthread.cc:33 (ep.so+0x0000000f9055) #3 platform_thread_wrap /home/abhinav/couchbase/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003d31) Change-Id: I316fb1a845fbee09f634d39e64057c170fab4795 Reviewed-on: http://review.couchbase.org/62974 Well-Formed: buildbot <[email protected]> Reviewed-by: Will Gardner <[email protected]> Tested-by: buildbot <[email protected]>
1 parent 644c09d commit 3da172a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/ep.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3134,7 +3134,7 @@ VBCBAdaptor::VBCBAdaptor(EventuallyPersistentStore *s,
31343134

31353135
bool VBCBAdaptor::run(void) {
31363136
if (!vbList.empty()) {
3137-
currentvb = vbList.front();
3137+
currentvb.store(vbList.front());
31383138
RCPtr<VBucket> vb = store->vbMap.getBucket(currentvb);
31393139
if (vb) {
31403140
if (visitor->pauseVisitor()) {

src/ep.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class VBCBAdaptor : public GlobalTask {
122122

123123
std::string getDescription() {
124124
std::stringstream rv;
125-
rv << label << " on vb " << currentvb;
125+
rv << label << " on vb " << currentvb.load();
126126
return rv.str();
127127
}
128128

@@ -134,7 +134,7 @@ class VBCBAdaptor : public GlobalTask {
134134
shared_ptr<VBucketVisitor> visitor;
135135
const char *label;
136136
double sleepTime;
137-
uint16_t currentvb;
137+
AtomicValue<uint16_t> currentvb;
138138

139139
DISALLOW_COPY_AND_ASSIGN(VBCBAdaptor);
140140
};

0 commit comments

Comments
 (0)