commit | ea75e1f63572fc72fb8520ba8c793523047acb49 | [log] [tgz] |
---|---|---|
author | Mate Szalay-Beko <symat@apache.org> | Wed Apr 14 22:22:09 2021 +0530 |
committer | Mohammad Arshad <arshad@apache.org> | Wed Apr 14 22:22:09 2021 +0530 |
tree | e9a6aa278365ccbf478319a060526deaeb747b9a | |
parent | 7fdadf7273f34dd0552db25a3771cf55b65e9208 [diff] |
ZOOKEEPER-4247: NPE while processing message from restarted quorum member When a ZooKeeper server realizes that an other quorum peer was shut down (e.g. during a rolling upgrade or rolling restart), the ServerCnxn.zkServer variable is set to null by QuorumPear.close(). This is why in the code we usually check the zkServer variable before using it. But this check was missing in one place thus causing NPE in NettyServerCnx.receiveMessage: ``` 2021-02-08T12:42:08.229+0000 [myid:] - ERROR [nioEventLoopGroup-4-1:NettyServerCnxnFactory$CnxnChannelHandler329]- Unexpected exception in receive java.lang.NullPointerException: null ~[zookeeper-3.6.2.jar:3.6.2] at org.apache.zookeeper.server.NettyServerCnxn.receiveMessage(NettyServerCnxn.java:518) at org.apache.zookeeper.server.NettyServerCnxn.processMessage(NettyServerCnxn.java:368) at org.apache.zookeeper.server.NettyServerCnxnFactory $CnxnChannelHandler.channelRead(NettyServerCnxnFactory.java:326) ... ``` In this commit we add the necessary check and (after throwing an IOException) we will basically ignore the processing of the received message when the remote ZooKeeper server is already down. Author: Mate Szalay-Beko <symat@apache.org> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mohammad Arshad <arshad@apache.org> Closes #1681 from symat/ZOOKEEPER-4247 and squashes the following commits: 7b140177d [Mate Szalay-Beko] ZOOKEEPER-4247: address PR comments b99ee986b [Mate Szalay-Beko] ZOOKEEPER-4247: address PR comments 3c8478a40 [Mate Szalay-Beko] ZOOKEEPER-4247: fix NPE happens while processing messages during quorum member restart
For the latest information about Apache ZooKeeper, please visit our website at:
and our wiki, at:
https://cwiki.apache.org/confluence/display/ZOOKEEPER
Either downloaded from https://zookeeper.apache.org/releases.html or found in zookeeper-assembly/target directory after building the project with maven.
apache-zookeeper-[version].tar.gz Contains all the source files which can be built by running: mvn clean install To generate an aggregated apidocs for zookeeper-server and zookeeper-jute: mvn javadoc:aggregate (generated files will be at target/site/apidocs) apache-zookeeper-[version]-bin.tar.gz Contains all the jar files required to run ZooKeeper Full documentation can also be found in the docs folder
As of version 3.5.5, the parent, zookeeper and zookeeper-jute artifacts are deployed to the central repository after the release is voted on and approved by the Apache ZooKeeper PMC:
https://repo1.maven.org/maven2/org/apache/zookeeper/zookeeper
If you are going to compile with Java 1.8, you should use a recent release at u211 or above.
We always welcome new contributors to the project! See How to Contribute for details on how to submit patch through pull request and our contribution workflow.