Alexey Serbin has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/17076


Change subject: [master] fix race between shutdown and TxnManager init
......................................................................

[master] fix race between shutdown and TxnManager init

I saw the following TSAN report while running one of the newer tests
introduced recently (TxnOpDispatcherITest.LifecycleBasic).  As I can
see, the race isn't related to the TxnOpDispatcher itself, but rather
to the way how Master::state_ field is used in the master's code.

WARNING: ThreadSanitizer: data race (pid=8313)
  Read of size 4 at 0x7b78000006b0 by thread T165:
    #0 kudu::master::Master::InitTxnManagerTask() 
src/kudu/master/master.cc:312:9 (libmaster.so+0x26f28b)
    #1 kudu::master::Master::ScheduleTxnManagerInit()::$_1::operator()() const 
src/kudu/master/master.cc:299:46 (libmaster.so+0x2741a1)

  Previous write of size 4 at 0x7b78000006b0 by main thread:
    #0 kudu::master::Master::ShutdownImpl() src/kudu/master/master.cc:406:12 
(libmaster.so+0x26da08)
    #1 kudu::master::Master::Shutdown() src/kudu/master/master.h:74:5 
(libmaster.so+0x275d49)
    #2 kudu::master::MiniMaster::Shutdown() 
src/kudu/master/mini_master.cc:117:14 (libmaster.so+0x2a9c38)
    #3 
kudu::cluster::InternalMiniCluster::ShutdownNodes(kudu::cluster::ClusterNodes) 
src/kudu/mini-cluster/internal_mini_cluster.cc:230:22 
(libmini_cluster.so+0x84037)
    #4 kudu::cluster::MiniCluster::Shutdown() 
src/kudu/mini-cluster/mini_cluster.h:79:5 (libitest_util.so+0xa59d4)
    #5 kudu::cluster::InternalMiniCluster::~InternalMiniCluster() 
src/kudu/mini-cluster/internal_mini_cluster.cc:94:3 (libmini_cluster.so+0x82a03)

This patch fixes the issue by making Master::state_ atomic.

Change-Id: Ifa7541aa7dc7dbdb8e6af5c1f40edf23b850fc92
---
M src/kudu/master/master.h
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/76/17076/1
--
To view, visit http://gerrit.cloudera.org:8080/17076
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa7541aa7dc7dbdb8e6af5c1f40edf23b850fc92
Gerrit-Change-Number: 17076
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <[email protected]>

Reply via email to