You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Alexey Serbin (Code Review)" <ge...@cloudera.org> on 2021/02/17 19:25:47 UTC

[kudu-CR] [master] fix race between shutdown and TxnManager init

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 <as...@cloudera.com>

[kudu-CR] [master] fix race between shutdown and TxnManager init

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has submitted this change and it was merged. ( 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
Reviewed-on: http://gerrit.cloudera.org:8080/17076
Tested-by: Kudu Jenkins
Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
M src/kudu/master/master.h
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Kudu Jenkins: Verified
  Andrew Wong: Looks good to me, approved

-- 
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: merged
Gerrit-Change-Id: Ifa7541aa7dc7dbdb8e6af5c1f40edf23b850fc92
Gerrit-Change-Number: 17076
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)

[kudu-CR] [master] fix race between shutdown and TxnManager init

Posted by "Andrew Wong (Code Review)" <ge...@cloudera.org>.
Andrew Wong has posted comments on this change. ( http://gerrit.cloudera.org:8080/17076 )

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


Patch Set 1: Code-Review+2


-- 
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: comment
Gerrit-Change-Id: Ifa7541aa7dc7dbdb8e6af5c1f40edf23b850fc92
Gerrit-Change-Number: 17076
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Wed, 17 Feb 2021 21:13:16 +0000
Gerrit-HasComments: No