Maksim Golov created THRIFT-2755:
------------------------------------

             Summary: ThreadSanitizer reports data race in 
                 Key: THRIFT-2755
                 URL: https://issues.apache.org/jira/browse/THRIFT-2755
             Project: Thrift
          Issue Type: Bug
          Components: C++ - Library
    Affects Versions: 1.0
         Environment: Ubuntu 12.04 x86_64, clang 3.3
            Reporter: Maksim Golov


ThreadSanitizer reports the following data race:

{code}
==================
WARNING: ThreadSanitizer: data race (pid=21413)
  Read of size 8 at 0x7d4c007eb0c8 by main thread (mutexes: write M250):
    #0 apache::thrift::concurrency::ThreadManager::Impl::addWorker(unsigned 
long) 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:363
 (exe+0x000000892e55)
    #1 apache::thrift::concurrency::SimpleThreadManager::start() 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:563
 (exe+0x0000008a93ad)
    #2 main /home/golov/project/Project/Main.cpp:201 (exe+0x000000758aa3)

  Previous write of size 8 at 0x7d4c007eb0c8 by thread T7 (mutexes: write M249):
    #0 apache::thrift::concurrency::ThreadManager::Worker::run() 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:251
 (exe+0x0000008ac9eb)
    #1 apache::thrift::concurrency::PthreadThread::threadMain(void*) 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/PosixThreadFactory.cpp:207
 (exe+0x0000008c4e70)

  Location is heap block of size 440 at 0x7d4c007eb0c0 allocated by main thread:
    #0 operator new(unsigned long) ??:0 (exe+0x000000726b56)
    #1 
apache::thrift::concurrency::ThreadManager::newSimpleThreadManager(unsigned 
long, unsigned long) 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:579
 (exe+0x000000894db3)
    #2 main /home/golov/project/Project/Main.cpp:197 (exe+0x000000758983)

  Mutex M250 created at:
    #0 pthread_mutex_init ??:0 (exe+0x000000729e65)
    #1 apache::thrift::concurrency::Mutex::DEFAULT_INITIALIZER(void*) 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Mutex.cpp:209
 (exe+0x0000008bf8e2)
rc/thrift/concurrency/Mutex.cpp:122 (exe+0x0000008c2a34)
    #3 impl 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Mutex.cpp:124
 (exe+0x0000008c0390)
    #4 Mutex 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Mutex.cpp:195
 (exe+0x0000008bf5a0)
    #5 Impl 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Monitor.cpp:49
 (exe+0x0000008c4aff)
    #6 Impl 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Monitor.cpp:51
 (exe+0x0000008c34c0)
    #7 Monitor 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Monitor.cpp:187
 (exe+0x0000008c2aee)
    #8 Impl 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:63
 (exe+0x0000008a8ea4)
    #9 SimpleThreadManager 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:557
 (exe+0x0000008a8b53)
    #10 SimpleThreadManager 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:558
 (exe+0x000000897020)
    #11 
apache::thrift::concurrency::ThreadManager::newSimpleThreadManager(unsigned 
long, unsigned long) 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:579
 (exe+0x000000894df2)
    #12 main /home/golov/project/Project/Main.cpp:197 (exe+0x000000758983)

  Mutex M249 created at:
    #0 pthread_mutex_init ??:0 (exe+0x000000729e65)
    #1 apache::thrift::concurrency::Mutex::DEFAULT_INITIALIZER(void*) 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Mutex.cpp:209
 (exe+0x0000008bf8e2)
    #2 impl 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Mutex.cpp:122
 (exe+0x0000008c2a34)
    #3 impl 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Mutex.cpp:124
 (exe+0x0000008c0390)
    #4 Mutex 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/Mutex.cpp:195
 (exe+0x0000008bf5a0)
    #5 Impl 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:63
 (exe+0x0000008a8e2e)
    #6 SimpleThreadManager 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:557
 (exe+0x0000008a8b53)
    #7 SimpleThreadManager 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:558
 (exe+0x000000897020)
    #8 
apache::thrift::concurrency::ThreadManager::newSimpleThreadManager(unsigned 
long, unsigned long) 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:579
 (exe+0x000000894df2)
    #9 main /home/golov/project/Project/Main.cpp:197 (exe+0x000000758983)

  Thread T7 (tid=21516, running) created by main thread at:
    #0 pthread_create ??:0 (exe+0x0000007298b2)
    #1 apache::thrift::concurrency::PthreadThread::start() 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/PosixThreadFactory.cpp:146
 (exe+0x0000008c90f9)
    #2 apache::thrift::concurrency::ThreadManager::Impl::addWorker(unsigned 
long) 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:357
 (exe+0x000000892bb1)
    #3 apache::thrift::concurrency::SimpleThreadManager::start() 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:563
 (exe+0x0000008a93ad)
    #4 main /home/golov/project/Project/Main.cpp:201 (exe+0x000000758aa3)

SUMMARY: ThreadSanitizer: data race 
/home/golov/project/Framework/ThirdParty/Thrift/Implementation/thrift-1.0.0_dev_f459868/lib/cpp/src/thrift/concurrency/ThreadManager.cpp:363
 apache::thrift::concurrency::ThreadManager::Impl::addWorker(unsigned long)
==================
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to