Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please see bug 2312 #2

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

steveyen
Copy link

No description provided.

trondn and others added 8 commits August 26, 2010 09:53
Both of these were using a common linked-list structure that could be
reorderd while being traversed.  Now they're copied out to a temporary
array at processing time and all the links are broken.

Also changed here is what it does when needing to deal with
pending_close (e.g. don't directly close stuff), but that's a
necessary casualty.
Instead of defaulting to "SERVER_ERROR unhandled storage type.", added
more case clauses to emit more detailed ascii-protocol
CLIENT/SERVER_ERROR strings.
trondn pushed a commit that referenced this pull request Mar 17, 2016
Fix race identified by ThreadSanitizer:

    WARNING: ThreadSanitizer: data race (pid=6808)
      Write of size 4 at 0x7ff2762e50b0 by thread T7:
        #0 mock_get_current_time /home/vagrant/couchbase-server/memcached/programs/engine_testapp/mock_server.c:142 (exe+0x0000000ad73a)
        #1 ExecutorThread::run() /home/vagrant/couchbase-server/ep-engine/src/executorthread.cc:101 (ep.so+0x000000215f3d)
        #2 launch_executor_thread(void*) /home/vagrant/couchbase-server/ep-engine/src/executorthread.cc:34 (ep.so+0x00000021560a)
        #3 platform_thread_wrap /home/vagrant/couchbase-server/platform/src/cb_pthreads.c:19 (libplatform.so.0.1.0+0x0000000033f4)

      Previous write of size 4 at 0x7ff2762e50b0 by thread T6:
        #0 mock_get_current_time /home/vagrant/couchbase-server/memcached/programs/engine_testapp/mock_server.c:142 (exe+0x0000000ad73a)
        #1 ExecutorThread::run() /home/vagrant/couchbase-server/ep-engine/src/executorthread.cc:101 (ep.so+0x000000215f3d)
        #2 launch_executor_thread(void*) /home/vagrant/couchbase-server/ep-engine/src/executorthread.cc:34 (ep.so+0x00000021560a)
        #3 platform_thread_wrap /home/vagrant/couchbase-server/platform/src/cb_pthreads.c:19 (libplatform.so.0.1.0+0x0000000033f4)

Change-Id: I392fd79245e690589f498690efe483ea856ef8d5
Reviewed-on: http://review.couchbase.org/43321
Tested-by: buildbot <[email protected]>
Reviewed-by: Michael Wiederhold <[email protected]>
Reviewed-by: Trond Norbye <[email protected]>
trondn pushed a commit that referenced this pull request Mar 17, 2016
Identified by ThreadSanitizer:

WARNING: ThreadSanitizer: data race (pid=34137)
  Write of size 4 at 0x7fa0ab35b288 by main thread:
    #0 mc_time_clock_tick() /home/daver/repos/couchbase/server/memcached/daemon/mc_time.cc:171 (memcached+0x0000000f9df3)
    #1 mc_time_clock_event_handler(int, short, void*) /home/daver/repos/couchbase/server/memcached/daemon/mc_time.cc:158 (memcached+0x0000000fa08f)
    #2 event_process_active_single_queue /home/couchbase/jenkins/workspace/cbdeps-build/label/ubuntu14.04/release/sherlock/deps/packages/build/libevent/libevent-prefix/src/libevent/event.c:1368 (libevent_core-2.0.so.5+0x00000000b7cb)
    #3 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 (libc.so.6+0x000000021ec4)

  Previous read of size 4 at 0x7fa0ab35b288 by thread T12 (mutexes: write M45839, write M45891):
    #0 mc_time_get_current_time /home/daver/repos/couchbase/server/memcached/daemon/mc_time.cc:94 (memcached+0x0000000fa0b6)
    #1 do_item_update /home/daver/repos/couchbase/server/memcached/engines/default_engine/items.c:358 (default_engine.so+0x000000008109)
    #2 item_get /home/daver/repos/couchbase/server/memcached/engines/default_engine/items.c:821 (default_engine.so+0x000000007deb)
    #3 default_get /home/daver/repos/couchbase/server/memcached/engines/default_engine/default_engine.c:335 (default_engine.so+0x000000003ef5)
    #4 EWB_Engine::get(engine_interface*, void const*, void**, void const*, int, unsigned short) /home/daver/repos/couchbase/server/memcached/engines/ewouldblock_engine/ewouldblock_engine.cc:247 (ewouldblock_engine.so+0x000000004fc1)
    #5 bucket_get /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:123 (memcached+0x0000000e096a)
    #6 process_bin_packet(conn*) /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:5051 (memcached+0x0000000d2100)
    memcached#7 run_event_loop /home/daver/repos/couchbase/server/memcached/daemon/connections.cc:174 (memcached+0x0000000c70c3)
    memcached#8 thread_libevent_process(int, short, void*) /home/daver/repos/couchbase/server/memcached/daemon/thread.cc:374 (memcached+0x0000000f8fc0)
    memcached#9 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)
    memcached#10 platform_thread_wrap /home/daver/repos/couchbase/server/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003730)

Change-Id: I9d73a6f5553d88beb1bcc2526763d892fe1b990f
Reviewed-on: http://review.couchbase.org/52484
Tested-by: buildbot <[email protected]>
Reviewed-by: Trond Norbye <[email protected]>
trondn pushed a commit that referenced this pull request Mar 17, 2016
As identified by ThreadSanitizer:

WARNING: ThreadSanitizer: data race (pid=3766)
  Write of size 4 at 0x7fe54b854b48 by main thread:
    #0 shutdown_server() /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:7530 (memcached+0x0000000dcca6)
    #1 event_signal_closure /home/couchbase/jenkins/workspace/cbdeps-build/label/ubuntu14.04/release/sherlock/deps/packages/build/libevent/libevent-prefix/src/libevent/event.c:1064 (libevent_core-2.0.so.5+0x00000000b9c8)
    #2 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 (libc.so.6+0x000000021ec4)

  Previous read of size 4 at 0x7fe54b854b48 by thread T3:
    #0 event_handler /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:6884 (memcached+0x0000000d79c6)
    #1 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)
    #2 platform_thread_wrap /home/daver/repos/couchbase/server/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003730)

Change-Id: I36c97dda9379718c2c1bb7f99698413616e59cbf
Reviewed-on: http://review.couchbase.org/52485
Tested-by: buildbot <[email protected]>
Reviewed-by: Trond Norbye <[email protected]>
trondn pushed a commit that referenced this pull request Mar 17, 2016
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)
    memcached#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)
    memcached#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)
    memcached#7 event_handler /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:6908 (memcached+0x0000000d7b24)
    memcached#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)
    memcached#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 <[email protected]>
Reviewed-by: Trond Norbye <[email protected]>
trondn pushed a commit that referenced this pull request Mar 17, 2016
As reported by ThreadSanitizer:

WARNING: ThreadSanitizer: data race (pid=34992)
  Read of size 4 at 0x7f98b38b5bf4 by main thread:
    #0 run_event_loop /home/daver/repos/couchbase/server/memcached/daemon/connections.cc:170 (memcached+0x0000000c7049)
    #1 event_handler /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:6912 (memcached+0x0000000d7b34)
    #2 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)
    #3 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 (libc.so.6+0x000000021ec4)

  Previous write of size 4 at 0x7f98b38b5bf4 by thread T19 (mutexes: write M45860):
    #0 verbosity_executor(conn*, void*) /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:3600 (memcached+0x0000000df219)
    #1 process_bin_packet(conn*) /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:5053 (memcached+0x0000000d2100)
    #2 run_event_loop /home/daver/repos/couchbase/server/memcached/daemon/connections.cc:174 (memcached+0x0000000c70c3)
    #3 event_handler /home/daver/repos/couchbase/server/memcached/daemon/memcached.cc:6912 (memcached+0x0000000d7b34)
    #4 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)
    #5 platform_thread_wrap /home/daver/repos/couchbase/server/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003730)

Change-Id: I2ae83312a532c67b2e3915e0c604e4e60558a8a7
Reviewed-on: http://review.couchbase.org/52487
Tested-by: buildbot <[email protected]>
Reviewed-by: Trond Norbye <[email protected]>
trondn pushed a commit that referenced this pull request Mar 17, 2016
Fix warning from ThreadSanitizer - appears to have been triggered by
some recent refactoring:

    WARNING: ThreadSanitizer: data race (pid=176554)
    Read of size 8 at 0x7f65cd0df200 by main thread:
      #0 main memcached/auditd/tests/testauditd.cc:258 (memcached_auditd_tests+0x0000000c3437)

    Previous write of size 8 at 0x7f65cd0df200 by thread T1 (mutexes: write M155):
      #0 audit_processed_listener() memcached/auditd/tests/testauditd.cc:142 (memcached_auditd_tests+0x0000000c2526)
      #1 consume_events(void*) memcached/auditd/src/auditd.cc:81 (libauditd.so.0.1.0+0x0000000109a1)
      #2 platform_thread_wrap (libplatform.so.0.1.0+0x000000003da1)

Change-Id: I90c21b62f999953015eaa25f5957c1a0db280e99
Reviewed-on: http://review.couchbase.org/54888
Reviewed-by: Trond Norbye <[email protected]>
Tested-by: buildbot <[email protected]>
trondn pushed a commit that referenced this pull request Mar 17, 2016
Add identified by ThreadSanitizer. mock_connstruct::references is
accessed concurrently from two threads; update to use std::atomic.

Details:

WARNING: ThreadSanitizer: data race (pid=32054)
  Write of size 4 at 0x7d280000eff0 by main thread:
    #0 mock_cookie_reserve() /memcached/programs/engine_testapp/mock_server.cc:129:5 (engine_testapp+0x0000004c77c3)
    #1 EventuallyPersistentEngine::reserveCookie() /ep-engine/src/ep_engine.cc:2016:28 (ep.so+0x0000000a2f05)
    #2 EventuallyPersistentEngine::createTapQueue() /ep-engine/src/ep_engine.cc:2574 (ep.so+0x0000000a2f05)
    #3 EvpGetTapIterator() /ep-engine/src/ep_engine.cc:1463:17 (ep.so+0x00000009f943)
    #4 mock_get_tap_iterator() /memcached/programs/engine_testapp/engine_testapp.cc:467:20 (engine_testapp+0x0000004c59ce)
    #5 test_tap_ack_stream() /ep-engine/tests/ep_testsuite.cc:7341:20 (ep_testsuite.so+0x00000003edf0)
    #6 execute_test() /memcached/programs/engine_testapp/engine_testapp.cc:1090:19 (engine_testapp+0x0000004c4142)
    memcached#7 main /memcached/programs/engine_testapp/engine_testapp.cc:1439 (engine_testapp+0x0000004c4142)

  Previous write of size 4 at 0x7d280000eff0 by thread T10 (mutexes: write M2181):
    #0 mock_cookie_release() /memcached/programs/engine_testapp/mock_server.cc:136:5 (engine_testapp+0x0000004c7801)
    #1 EventuallyPersistentEngine::releaseCookie() /ep-engine/src/ep_engine.cc:2025:28 (ep.so+0x0000000a1142)
    #2 ConnHandler::releaseReference() /ep-engine/src/tapconnection.cc:311:9 (ep.so+0x0000000fc5d2)
    #3 TapConnMap::manageConnections() /ep-engine/src/connmap.cc:532:10 (ep.so+0x00000003e972)
    #4 ConnManager::run() /ep-engine/src/connmap.cc:150:9 (ep.so+0x00000004a60e)
    #5 ExecutorThread::run() /ep-engine/src/executorthread.cc:115:26 (ep.so+0x0000000d8a9e)
    #6 launch_executor_thread() /ep-engine/src/executorthread.cc:33:9 (ep.so+0x0000000d8615)
    memcached#7 platform_thread_wrap /platform/src/cb_pthreads.c:23:5 (libplatform.so.0.1.0+0x000000003c31)

Change-Id: Ib1861cf9b66e31b5f50e6b114119da72d54cde10
Reviewed-on: http://review.couchbase.org/55866
Reviewed-by: abhinav dangeti <[email protected]>
Tested-by: buildbot <[email protected]>
trondn pushed a commit that referenced this pull request Mar 17, 2016
…okie

WARNING: ThreadSanitizer: data race (pid=39351)
  Write of size 8 at 0x7d2800009f60 by thread T18 (mutexes: write M1477):
    #0 free <null> (engine_testapp+0x00000045ca0b)
    #1 mock_cookie_release(void const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/memcached/programs/engine_testapp/mock_server.cc:138 (engine_testapp+0x0000004c7850)
    #2 EventuallyPersistentEngine::releaseCookie(void const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:2031 (ep.so+0x0000000add62)
    #3 ConnHandler::releaseReference(bool) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/tapconnection.cc:311 (ep.so+0x0000001106d2)
    #4 DcpConnMap::manageConnections() /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/connmap.cc:1189 (ep.so+0x0000000461df)
    #5 ConnManager::run() /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/connmap.cc:150 (ep.so+0x00000004c5ae)
    #6 ExecutorThread::run() /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/executorthread.cc:115 (ep.so+0x0000000eaabd)
    memcached#7 launch_executor_thread(void*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/executorthread.cc:33 (ep.so+0x0000000ea685)
    memcached#8 platform_thread_wrap /home/couchbase/.ccache/tmp/cb_pthread.tmp.334a1e8a4a71.179339.i (libplatform.so.0.1.0+0x0000000041c1)

  Previous read of size 8 at 0x7d2800009f60 by thread T20:
    #0 mock_get_engine_specific(void const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/memcached/programs/engine_testapp/mock_server.cc:82 (engine_testapp+0x0000004c75a0)
    #1 EventuallyPersistentEngine::handleDisconnect(void const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.h:584 (ep.so+0x0000000c956d)
    #2 EvpHandleDisconnect(void const*, ENGINE_EVENT_TYPE, void const*, void const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:1786 (ep.so+0x0000000aeb46)
    #3 destroy_mock_cookie /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/memcached/programs/engine_testapp/mock_server.cc:319 (engine_testapp+0x0000004c7f83)
    #4 perf_dcp_client(Handle_args*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/tests/ep_perfsuite.cc:653 (ep_perfsuite.so+0x00000000fcdc)
    #5 platform_thread_wrap /home/couchbase/.ccache/tmp/cb_pthread.tmp.334a1e8a4a71.179339.i (libplatform.so.0.1.0+0x0000000041c1)

WARNING: ThreadSanitizer: data race (pid=39351)
  Write of size 8 at 0x7d2800009ff0 by thread T18 (mutexes: write M1477):
    #0 free <null> (engine_testapp+0x00000045ca0b)
    #1 mock_cookie_release(void const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/memcached/programs/engine_testapp/mock_server.cc:138 (engine_testapp+0x0000004c7850)
    #2 EventuallyPersistentEngine::releaseCookie(void const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:2031 (ep.so+0x0000000add62)
    #3 ConnHandler::releaseReference(bool) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/tapconnection.cc:311 (ep.so+0x0000001106d2)
    #4 DcpConnMap::manageConnections() /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/connmap.cc:1189 (ep.so+0x0000000461df)
    #5 ConnManager::run() /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/connmap.cc:150 (ep.so+0x00000004c5ae)
    #6 ExecutorThread::run() /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/executorthread.cc:115 (ep.so+0x0000000eaabd)
    memcached#7 launch_executor_thread(void*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/executorthread.cc:33 (ep.so+0x0000000ea685)
    memcached#8 platform_thread_wrap /home/couchbase/.ccache/tmp/cb_pthread.tmp.334a1e8a4a71.179339.i (libplatform.so.0.1.0+0x0000000041c1)

  Previous atomic read of size 4 at 0x7d2800009ff0 by thread T20:
    #0 __tsan_atomic32_load <null> (engine_testapp+0x0000004a51b4)
    #1 destroy_mock_cookie /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/memcached/programs/engine_testapp/mock_server.cc:318 (engine_testapp+0x0000004c7fa0)
    #2 perf_dcp_client(Handle_args*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/tests/ep_perfsuite.cc:653 (ep_perfsuite.so+0x00000000fcdc)
    #3 platform_thread_wrap /home/couchbase/.ccache/tmp/cb_pthread.tmp.334a1e8a4a71.179339.i (libplatform.so.0.1.0+0x0000000041c1)

Change-Id: If36aa90a181e5cd49aeede04065b78bb1fe17dc1
Reviewed-on: http://review.couchbase.org/56100
Tested-by: buildbot <[email protected]>
Reviewed-by: Dave Rigby <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants