You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2021/02/24 13:22:07 UTC
[GitHub] [zookeeper] eolivelli commented on a change in pull request #1596: ZOOKEEPER-4203: Leader swallows the ZooKeeperServer.State.ERROR from Leader.LearnerCnxAcceptor in some concurrency condition
eolivelli commented on a change in pull request #1596:
URL: https://github.com/apache/zookeeper/pull/1596#discussion_r581952952
##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumZooKeeperServer.java
##########
@@ -189,9 +189,18 @@ public void dumpConf(PrintWriter pwriter) {
pwriter.print(self.getQuorumVerifier().toString());
}
+ private final Object stateChangeMutex = new Object();
+
@Override
protected void setState(State state) {
- this.state = state;
+ synchronized (stateChangeMutex) {
+ if (this.state == State.ERROR) {
+ if (state == State.RUNNING || state == State.INITIAL) {
+ return;
Review comment:
we should add a relevant log in order to see if this case is happening.
Creating a test that reproduces the problem and demonstrates that this fix actually resolves the problem would be better
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org