ewouldblock_engine: Fix data race on cookie_map
ewouldblock_engine: Fix data race on cookie_map

As identified by ThreadSanitizer:

WARNING: ThreadSanitizer: data race (pid=950)
  Write of size 8 at 0x7d100002db60 by thread T17 (mutexes: write M45854):
    #0 operator delete(void*) <null>:0 (memcached+0x00000005a6bb)
    #1 __gnu_cxx::new_allocator<...>::deallocate(...) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/ext/new_allocator.h:110 (ewouldblock_engine.so+0x000000007677)
    #2 std::_Rb_tree<>::erase(...) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/stl_tree.h:890 (ewouldblock_engine.so+0x000000005890)
    #3 bucket_unknown_command /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:130 (memcached+0x0000000e8cd0)
    #4 process_bin_unknown_packet(conn*) /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:1877 (memcached+0x0000000d2223)
    #5 run_event_loop /home/daver/repos/couchbase/server/memcached/daemon/connections.cc:174 (memcached+0x0000000c70c3)
    #6 event_handler /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:6908 (memcached+0x0000000d7b24)
    #7 event_persist_closure /home/couchbase/jenkins/workspace/cbdeps-build/label/ubuntu14.04/release/sherlock/deps/packages/build/libevent/libevent-prefix/src/libevent/event.c:1319 (libevent_core-2.0.so.5+0x00000000b6c7)
    #8 platform_thread_wrap /home/daver/repos/couchbase/server/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003730)

  Previous read of size 8 at 0x7d100002db60 by thread T16 (mutexes: write M45851, write M45962):
    #0 std::less<void const*>::operator()(void const* const&, void const* const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/stl_function.h:371 (ewouldblock_engine.so+0x000000006ac8)
    #1 EWB_Engine::should_inject_error(...) /home/daver/repos/couchbase/server/memcached/engines/ewouldblock_engine/ewouldblock_engine.cc:110 (ewouldblock_engine.so+0x000000006c31)
    #2 EWB_Engine::allocate(...) /home/daver/repos/couchbase/server/memcached/engines/ewouldblock_engine/ewouldblock_engine.cc:211 (ewouldblock_engine.so+0x000000004d33)
    #3 add_set_replace_executor(conn*, void*, ENGINE_STORE_OPERATION) /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:3940 (memcached+0x0000000e7b40)
    #4 setq_executor(conn*, void*) /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:4079 (memcached+0x0000000e0496)
    #5 process_bin_packet(conn*) /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:5051 (memcached+0x0000000d2100)
    #6 run_event_loop /home/daver/repos/couchbase/server/memcached/daemon/connections.cc:174 (memcached+0x0000000c70c3)
    #7 event_handler /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:6908 (memcached+0x0000000d7b24)
    #8 event_persist_closure /home/couchbase/jenkins/workspace/cbdeps-build/label/ubuntu14.04/release/sherlock/deps/packages/build/libevent/libevent-prefix/src/libevent/event.c:1319 (libevent_core-2.0.so.5+0x00000000b6c7)
    #9 platform_thread_wrap /home/daver/repos/couchbase/server/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003730)

Change-Id: Ia558b1947f2c913d6fa7943de0e85ba975a0c2b1
Reviewed-on: http://review.couchbase.org/52486
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>

daverigby/kv_engine,owendCB/memcached,couchbase/memcached,couchbase/memcached,daverigby/memcached,owendCB/memcached,daverigby/memcached,daverigby/kv_engine,daverigby/memcached,cloudrain21/memcached-1,couchbase/memcached,cloudrain21/memcached-1,cloudrain21/memcached-1,cloudrain21/memcached-1,daverigby/kv_engine,owendCB/memcached,owendCB/memcached,daverigby/memcached,couchbase/memcached,daverigby/kv_engine