Description
On a test cluster we got a
java.lang.NullPointerException at org.apache.hadoop.hbase.master.HMaster.getClusterStatus(HMaster.java:1742) at org.apache.hadoop.hbase.master.balancer.ClusterStatusChore.chore(ClusterStatusChore.java:50) at org.apache.hadoop.hbase.Chore.run(Chore.java:87)
In HMaster.getClusterStatus() we have a couple of NPE.
listChildrenNoWatch() may return null if the node is not found
try { backupMasterStrings = ZKUtil.listChildrenNoWatch(this.zooKeeper, this.zooKeeper.backupMasterAddressesZNode); <--- THIS MAY RETURN NULL } catch (KeeperException e) { LOG.warn(this.zooKeeper.prefix("Unable to list backup servers"), e); backupMasterStrings = new ArrayList<String>(0); } List<ServerName> backupMasters = new ArrayList<ServerName>( backupMasterStrings.size()); <--- WE DON'T CHECK FOR NULL
then below, we build ClusterStatus with args that may be null
String clusterId = fileSystemManager != null ? fileSystemManager.getClusterId().toString() : null; Map<String, RegionState> regionsInTransition = assignmentManager != null ? assignmentManager.getRegionStates().getRegionsInTransition() : null; String[] coprocessors = cpHost != null ? getMasterCoprocessors() : null; Map<ServerName, ServerLoad> onlineServers = null; Set<ServerName> deadServers = null; if (serverManager != null) { deadServers = serverManager.getDeadServers().copyServerNames(); onlineServers = serverManager.getOnlineServers(); } return new ClusterStatus(VersionInfo.getVersion(), clusterId, onlineServers, deadServers, serverName, backupMasters, regionsInTransition, coprocessors, balancerOn);
In ClusterStatus equals(), hashCode(), toString() we don't check for nulls