[ https://issues.apache.org/jira/browse/ZOOKEEPER-1789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13792123#comment-13792123 ]
Alexander Shraer commented on ZOOKEEPER-1789: --------------------------------------------- thanks once again Raul. Yeah, I guess it should be getView instead of getVotingView, or something similar. It is possible, however, that the sid is not there so the following code should deal with the case that electionAddr is null, perhaps by calling connectOne(sid) instead of connectOne(sid, electionAddr), but I'm not completely sure. You may also want to look at ZK-1633. CnxManagerTest.java is where to look for test examples for this one. There seems to be a related bug - observers may not be declared in the view and have a special id (although if they fall within this "if" like you describe they have positive id so they should be in getView). See the code below the one you quote in how it deals with special ObserverId = -1. It would be great if you can fix and test the bug you identified, dealing also with the case that electionAddr may be end up being null if the id is not in the view. I can then fix the remaining issue of special ObserverId. > 3.4.x observer causes NPE on 3.5.0 (trunk) participants > ------------------------------------------------------- > > Key: ZOOKEEPER-1789 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1789 > Project: ZooKeeper > Issue Type: Bug > Reporter: Raul Gutierrez Segales > Assignee: Alexander Shraer > > (assigning to Alex because this was introduced by ZOOKEEPER-107, but will > upload a patch as well.) > I have a 5 participants cluster running what will be 3.5.0 (i.e.: trunk as of > today) and an observer running 3.4 (trunk from 3.4 branch). When the observer > tries to establish a connection to the participants I get: > {noformat} > Thread Thread[10.40.78.121:3888,5,main] died java.lang.NullPointerException > at > org.apache.zookeeper.server.quorum.QuorumCnxManager.receiveConnection(QuorumCnxManager.java:240) > at > org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener.run(QuorumCnxManager.java:552) > {noformat} > Looking at QuorumCnxManager.java:240: > {noformat} > if (protocolVersion >= 0) { // this is a server id and not a > protocol version > sid = protocolVersion; > electionAddr = self.getVotingView().get(sid).electionAddr; > } else { > {noformat} > and self.getVotingView().get(sid) will be null for Observers. So this block > should cover that case. -- This message was sent by Atlassian JIRA (v6.1#6144)