MB-19229: Address possible data race in vbucket.cc: numHpChks 66/62966/5
authorabhinavdangeti <abhinav@couchbase.com>
Mon, 5 Oct 2015 21:21:54 +0000 (14:21 -0700)
committerChiyoung Seo <chiyoung@couchbase.com>
Sat, 23 Apr 2016 01:01:20 +0000 (01:01 +0000)
commit2e4ce119d97b2d9ee88b999cd2862a0673bf1ff6
tree3e58379e6201fa48401f6e064cbc4cc91410e68c
parent946915951a70aba4026a240677cf15091aab8b89
MB-19229: Address possible data race in vbucket.cc: numHpChks

WARNING: ThreadSanitizer: data race (pid=23450)

  Write of size 8 at 0x7d680001f678 by thread T5 (mutexes: write M11600, write M15531):
    #0 VBucket::notifyCheckpointPersisted(EventuallyPersistentEngine&, unsigned long, bool) /home/abhinav/couchbase/ep-engine/src/vbucket.cc:356 (ep.so+0x00000014b3e3)
    #1 EventuallyPersistentStore::flushVBucket(unsigned short) /home/abhinav/couchbase/ep-engine/src/ep.cc:3334 (ep.so+0x000000099b9f)
    #2 Flusher::flushVB() /home/abhinav/couchbase/ep-engine/src/flusher.cc:296 (ep.so+0x0000000ffe7f)
    #3 Flusher::step(GlobalTask*) /home/abhinav/couchbase/ep-engine/src/flusher.cc:186 (ep.so+0x0000000fe375)
    #4 FlusherTask::run() /home/abhinav/couchbase/ep-engine/src/tasks.cc:62 (ep.so+0x00000013c928)
    #5 ExecutorThread::run() /home/abhinav/couchbase/ep-engine/src/executorthread.cc:112 (ep.so+0x0000000f9503)
    #6 launch_executor_thread(void*) /home/abhinav/couchbase/ep-engine/src/executorthread.cc:33 (ep.so+0x0000000f9085)
    #7 platform_thread_wrap /home/abhinav/couchbase/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003d31)

  Previous read of size 8 at 0x7d680001f678 by main thread (mutexes: write M910146210457775232):
    #0 VBucket::getHighPriorityChkSize() /home/abhinav/couchbase/ep-engine/src/vbucket.cc:401 (ep.so+0x00000014b7d9)
    #1 VBucketCountVisitor::visitBucket(RCPtr<VBucket>&) /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:3030 (ep.so+0x0000000ba940)
    #2 VBucketCountAggregator::visitBucket(RCPtr<VBucket>&) /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:3067 (ep.so+0x0000000baf43)
    #3 EventuallyPersistentStore::visit(VBucketVisitor&) /home/abhinav/couchbase/ep-engine/src/ep.cc:3719 (ep.so+0x000000089917)
    #4 EventuallyPersistentEngine::doEngineStats(void const*, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:3093 (ep.so+0x0000000bb5ab)
    #5 EventuallyPersistentEngine::getStats(void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:4554 (ep.so+0x0000000c5cac)
    #6 EvpGetStats(engine_interface*, void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:213 (ep.so+0x0000000b4dee)
    #7 mock_get_stats(engine_interface*, void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/abhinav/couchbase/memcached/programs/engine_testapp/engine_testapp.cc:239 (engine_testapp+0x0000000ba9ad)
    #8 get_int_stat(engine_interface*, engine_interface_v1*, char const*, char const*) /home/abhinav/couchbase/ep-engine/tests/ep_test_apis.cc:990 (ep_testsuite.so+0x0000000aebb1)
    #9 test_access_scanner(engine_interface*, engine_interface_v1*) /home/abhinav/couchbase/ep-engine/tests/ep_testsuite.cc:8569 (ep_testsuite.so+0x00000002efd7)
    #10 execute_test(test, char const*, char const*) /home/abhinav/couchbase/memcached/programs/engine_testapp/engine_testapp.cc:1090 (engine_testapp+0x0000000b946c)
    #11 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 (libc.so.6+0x000000021ec4)

Change-Id: I98021a535bd78d34e31d428e364192bb2ef33dcf
Reviewed-on: http://review.couchbase.org/62966
Well-Formed: buildbot <build@couchbase.com>
Reviewed-by: Will Gardner <will.gardner@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
src/vbucket.cc
src/vbucket.h