[ https://issues.apache.org/jira/browse/HBASE-25307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17239095#comment-17239095 ]
Duo Zhang commented on HBASE-25307: ----------------------------------- Checked the code again, all the places where we access the connections PoolMap is under synchronzed(connections), so I do not think we need to make the PoolMap itself thread safe. And since it is only used in AbstractRpcClient, I suggest we just rename it to RpcConnectionMap, and move it to the ipc package and change it to package private. Thoughts? Thanks. > ThreadLocal pooling leads to NullPointerException > ------------------------------------------------- > > Key: HBASE-25307 > URL: https://issues.apache.org/jira/browse/HBASE-25307 > Project: HBase > Issue Type: Bug > Components: Client > Affects Versions: 3.0.0-alpha-1 > Reporter: Balazs Meszaros > Assignee: Balazs Meszaros > Priority: Major > > We got NPE after setting {{hbase.client.ipc.pool.type}} to {{thread-local}}: > {noformat} > 20/11/18 01:53:04 ERROR yarn.ApplicationMaster: User class threw exception: > java.lang.NullPointerException > java.lang.NullPointerException > at > org.apache.hadoop.hbase.ipc.AbstractRpcClient.close(AbstractRpcClient.java:496) > at > org.apache.hadoop.hbase.client.ConnectionImplementation.close(ConnectionImplementation.java:1944) > at > org.apache.hadoop.hbase.mapreduce.TableInputFormatBase.close(TableInputFormatBase.java:660) > {noformat} > The root cause of the issue is probably at > {{PoolMap.ThreadLocalPool.values()}}: > {code:java} > public Collection<R> values() { > List<R> values = new ArrayList<>(); > values.add(get()); > return values; > } > {code} > It adds {{null}} into the collection if the current thread does not have any > resources which leads to NPE later. > I traced the usages of values() and it should return every resource, not just > that one which is attached to the caller thread. -- This message was sent by Atlassian Jira (v8.3.4#803005)