Address data race while fetching activeSnoozingBackfills
Address data race while fetching activeSnoozingBackfills

WARNING: ThreadSanitizer: data race (pid=28260)

Read of size 2 at 0x7d840001dcc2 by main thread (mutexes: write M38157):

0 DcpConnMap::getNumActiveSnoozingBackfills() const /home/abhinav/couchbase/ep-engine/src/connmap.h:479 (ep.so+0x0000000c119c)
1 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:4564 (ep.so+0x0000000c4f75)
2 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+0x0000000b3e0e)
3 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)
4 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+0x0000000ae9b1)
5 dcp_stream(engine_interface*, engine_interface_v1*, char const*, void const*, unsigned short, unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, int, int, int, int, bool, bool, unsigned char, bool, unsigned long*, bool) /home/abhinav/couchbase/ep-engine/tests/ep_testsuite.cc:4090 (ep_testsuite.so+0x00000009773c)
6 test_dcp_producer_stream_req_full(engine_interface*, engine_interface_v1*) /home/abhinav/couchbase/ep-engine/tests/ep_testsuite.cc:4434 (ep_testsuite.so+0x000000075303)
7 execute_test(test, char const*, char const*) /home/abhinav/couchbase/memcached/programs/engine_testapp/engine_testapp.cc:1090 (engine_testapp+0x0000000b946c)
8 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 (libc.so.6+0x000000021ec4)

Previous write of size 2 at 0x7d840001dcc2 by thread T9:

0 DcpConnMap::decrNumActiveSnoozingBackfills() /home/abhinav/couchbase/ep-engine/src/connmap.cc:1255 (ep.so+0x00000004a895)
1 BackfillManager::backfill() /home/abhinav/couchbase/ep-engine/src/dcp/backfill-manager.cc:251 (ep.so+0x0000000509aa)
2 BackfillManagerTask::run() /home/abhinav/couchbase/ep-engine/src/dcp/backfill-manager.cc:43 (ep.so+0x00000005051f)
3 ExecutorThread::run() /home/abhinav/couchbase/ep-engine/src/executorthread.cc:112 (ep.so+0x0000000f829a)
4 launch_executor_thread(void*) /home/abhinav/couchbase/ep-engine/src/executorthread.cc:33 (ep.so+0x0000000f7ea5)
5 platform_thread_wrap /home/abhinav/couchbase/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003d31)

Change-Id: I58dc0ccff30ef876bf214ef42d8b44ea198c2865
Reviewed-on: http://review.couchbase.org/55747
Reviewed-by: Chiyoung Seo <fcffc23db27b19ee4ebba46695ee6b50e09216a2@couchbase.com>
Tested-by: abhinav dangeti <d73ef2279de6577f7bf081737ee47554bbb7dc82@couchbase.com>

membase/ep-engine,couchbase/ep-engine,hisundar/ep-engine,owendCB/ep-engine,membase/ep-engine,couchbase/ep-engine,owendCB/ep-engine,owendCB/ep-engine,teligent-ru/ep-engine,daverigby/kv_engine,couchbase/ep-engine,daverigby/kv_engine,teligent-ru/ep-engine,daverigby/kv_engine,hisundar/ep-engine,daverigby/kv_engine,owendCB/ep-engine,teligent-ru/ep-engine,teligent-ru/ep-engine,hisundar/ep-engine,daverigby/ep-engine,daverigby/ep-engine,membase/ep-engine,membase/ep-engine,daverigby/ep-engine,couchbase/ep-engine,hisundar/ep-engine,daverigby/ep-engine