Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-25307

ThreadLocal pooling leads to NullPointerException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-1
    • Fix Version/s: 3.0.0-alpha-1, 2.4.0, 2.2.7, 2.3.4
    • Component/s: Client
    • Labels:
      None

      Description

      We got NPE after setting hbase.client.ipc.pool.type to thread-local:

      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)
      

      The root cause of the issue is probably at PoolMap.ThreadLocalPool.values():

      public Collection<R> values() {
        List<R> values = new ArrayList<>();
        values.add(get());
        return values;
      }
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              meszibalu Balazs Meszaros
              Reporter:
              meszibalu Balazs Meszaros
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: