Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 Reviewed-on: http://gerrit.cloudera.org:8080/17076 Tested-by: Kudu Jenkins Reviewed-by: Andrew Wong <[email protected]>
- Loading branch information