Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-19249

ep-engine: Potential incorrect Connection disconnect handling due to data race

    XMLWordPrintable

Details

    • Untriaged
    • Unknown

    Description

      As identified by TSan, there is a potential data race on ConnHandlers' state flags (connected, disconnect and supportAck).

      This could result in the changes to the state of a ConnHandler object not being immediately detected. I haven't analysed the code paths in detail, but at least in theory this could result in (for example) a TAP connection not getting disconnected when it should.

      TSan report:

      WARNING: ThreadSanitizer: data race (pid=2443)
          
            Read of size 1 at 0x7d5000016a58 by thread T10:
              #0 ConnHandler::doDisconnect() /home/abhinav/couchbase/ep-engine/src/tapconnection.h:375 (ep.so+0x000000058416)
              #1 ExecutorThread::run() /home/abhinav/couchbase/ep-engine/src/executorthread.cc:112 (ep.so+0x0000000f87f6)
              #2 launch_executor_thread(void*) /home/abhinav/couchbase/ep-engine/src/executorthread.cc:33 (ep.so+0x0000000f8395)
              #3 platform_thread_wrap /home/abhinav/couchbase/platform/src/cb_pthreads.c:23 (libplatform.so.0.1.0+0x000000003d31)
          
            Previous write of size 1 at 0x7d5000016a58 by main thread:
              [failed to restore the stack]
          
            Location is heap block of size 480 at 0x7d5000016a00 allocated by main thread:
              #0 operator new(unsigned long) <null>:0 (engine_testapp+0x00000005084d)
              #1 DcpConnMap::newConsumer(void const*, std::string const&) /home/abhinav/couchbase/ep-engine/src/connmap.cc:969 (ep.so+0x000000048384)
              #2 EventuallyPersistentEngine::dcpOpen(void const*, unsigned int, unsigned int, unsigned int, void*, unsigned short) /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:6189 (ep.so+0x0000000d3668)
              #3 EvpDcpOpen(engine_interface*, void const*, unsigned int, unsigned int, unsigned int, void*, unsigned short) /home/abhinav/couchbase/ep-engine/src/ep_engine.cc:1494 (ep.so+0x0000000b4e5f)
              #4 mock_dcp_open(engine_interface*, void const*, unsigned int, unsigned int, unsigned int, void*, unsigned short) /home/abhinav/couchbase/memcached/programs/engine_testapp/engine_testapp.cc:488 (engine_testapp+0x0000000bb015)
              #5 test_dcp_consumer_flow_control_aggressive(engine_interface*, engine_interface_v1*) /home/abhinav/couchbase/ep-engine/tests/ep_testsuite.cc:3826 (ep_testsuite.so+0x00000006ecfd)
              #6 execute_test(test, char const*, char const*) /home/abhinav/couchbase/memcached/programs/engine_testapp/engine_testapp.cc:1090 (engine_testapp+0x0000000b946c)
              #7 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 (libc.so.6+0x000000021ec4)
      

      Note: Already fixed in watson: http://review.couchbase.org/55784

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              drigby Dave Rigby (Inactive)
              drigby Dave Rigby (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  PagerDuty