MB-21765: Missing lock from doWorkerStat 62/70262/3
authorDaniel Owen <owend@couchbase.com>
Tue, 22 Nov 2016 16:35:47 +0000 (16:35 +0000)
committerDave Rigby <daver@couchbase.com>
Wed, 23 Nov 2016 20:58:55 +0000 (20:58 +0000)
commit2e5daf7c54fa20208759256ae67520a70e8519d1
tree652ee3f28f095a52f4b6f0393deb9f2ed3acbd88
parent67f15f59459b96260b373f44d74537782475cf64
MB-21765: Missing lock from doWorkerStat

tMutex must be acquired before accessing the threadQ data structure.

07:01:46 WARNING: ThreadSanitizer: data race (pid=32512)
07:01:46 Write of size 8 at 0x7d1c00016eb8 by thread T9 (mutexes: write M27337):
07:01:46 #0 operator delete(void*) <null> (engine_testapp+0x000000464cbb)
07:01:46 #1 <null> <null> (libstdc++.so.6+0x0000000c1ac7)
07:01:46 #2 ExecutorThread::run() /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/executorthread.cc:127 (ep.so+0x0000000f7ff5)
07:01:46 #3 launch_executor_thread(void*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/executorthread.cc:32 (ep.so+0x0000000f78a5)
07:01:46 #4 CouchbaseThread::run() /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/platform/src/cb_pthreads.cc:58 (libplatform_so.so.0.1.0+0x000000007b91)
07:01:46 #5 platform_thread_wrap(void*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/platform/src/cb_pthreads.cc:71 (libplatform_so.so.0.1.0+0x000000005e92)
07:01:46
07:01:46 Previous read of size 8 at 0x7d1c00016eb8 by main thread (mutexes: write M20977, write M26658):
07:01:46 #0 strlen <null> (engine_testapp+0x0000004652af)
07:01:46 #1 showJobLog(char const*, char const*, std::vector<TaskLogEntry, std::allocator<TaskLogEntry> > const&, void const*, void (char const*, unsigned short, char const*, unsigned int, void const*)) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/statwriter.h:39 (ep.so+0x0000000f346b)
07:01:46 #2 ExecutorPool::doWorkerStat(EventuallyPersistentEngine*, void const*, void (char const*, unsigned short, char const*, unsigned int, void const*)) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/executorpool.cc:801 (ep.so+0x0000000f2ce2)
07:01:46 #3 EventuallyPersistentEngine::getStats(void const*, char const*, int, void (char const*, unsigned short, char const*, unsigned int, void const*)) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:4383 (ep.so+0x0000000c30bf)

Change-Id: Iae7aa0fe9da15805671762516221f25da69fe5d8
Reviewed-on: http://review.couchbase.org/70262
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
src/executorpool.cc