[ https://issues.apache.org/jira/browse/ZOOKEEPER-2488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16695348#comment-16695348 ]
Michael K. Edwards commented on ZOOKEEPER-2488: ----------------------------------------------- Looks to me like all cases of the test-and-set/test-and-clear idiom for {{shuttingDownLE}} should be wrapped in {{synchronized}} blocks, to ensure atomicity and visibility of the change. I think https://github.com/apache/zookeeper/pull/707/commits/3dfd49f6bfea357c838e21d5a2e4f1486ed753e9 is a sufficient fix. > Unsynchronized access to shuttingDownLE in QuorumPeer > ----------------------------------------------------- > > Key: ZOOKEEPER-2488 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2488 > Project: ZooKeeper > Issue Type: Bug > Components: server > Affects Versions: 3.5.2 > Reporter: Michael Han > Assignee: gaoshu > Priority: Major > Fix For: 3.6.0, 3.5.5 > > > Access to shuttingDownLE in QuorumPeer is not synchronized here: > https://github.com/apache/zookeeper/blob/3c37184e83a3e68b73544cebccf9388eea26f523/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java#L1066 > https://github.com/apache/zookeeper/blob/3c37184e83a3e68b73544cebccf9388eea26f523/src/java/main/org/ > The access should be synchronized as the same variable might be accessed > in QuormPeer::restartLeaderElection, which is synchronized. -- This message was sent by Atlassian JIRA (v7.6.3#76005)