Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-7157

NPE possible in cache eviction 'HIR_NONRESIDENT'

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Out of Date
    • Affects Version/s: 8.2.2.Final
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      Unclear how to reproduce, but null values should be checked.

      Show
      Unclear how to reproduce, but null values should be checked.

      Description

      Observed the following:

      java.lang.NullPointerException: null
      at org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8$LIRSEvictionPolicy.findIfEntriesNeedEvicting(BoundedEquivalentConcurrentHashMapV8.java:1531) ~[org.infinispan-infinispan-commons-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8.compute(BoundedEquivalentConcurrentHashMapV8.java:3657) ~[org.infinispan-infinispan-commons-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.container.DefaultDataContainer.put(DefaultDataContainer.java:227) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.container.entries.ReadCommittedEntry.commit(ReadCommittedEntry.java:168) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.statetransfer.CommitManager.commit(CommitManager.java:100) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.interceptors.locking.ClusteringDependentLogic$LocalLogic.commitSingleEntry(ClusteringDependentLogic.java:299) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.interceptors.locking.ClusteringDependentLogic$AbstractClusteringDependentLogic.commitEntry(ClusteringDependentLogic.java:115) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.interceptors.EntryWrappingInterceptor.commitContextEntry(EntryWrappingInterceptor.java:479) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.interceptors.EntryWrappingInterceptor.commitEntryIfNeeded(EntryWrappingInterceptor.java:655) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.interceptors.EntryWrappingInterceptor.commitContextEntries(EntryWrappingInterceptor.java:456) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]
      at org.infinispan.interceptors.EntryWrappingInterceptor.invokeNextAndApplyChanges(EntryWrappingInterceptor.java:530) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      ...

      I think the cause is this code:

      } else if (evict.state == Recency.HIR_NONRESIDENT) {
      Node<K, V> node = f.find(hash, evict.getKey());
      V prevValue = node.val;
      ^^^ node can be null here
      if (prevValue != NULL_VALUE)

      { node.val = (V) NULL_VALUE; map.addCount(-1, -1); This is 8.2.2 In 8.2.x the code is: }

      else if (evict.state == Recency.HIR_NONRESIDENT) {
      BoundedEquivalentConcurrentHashMapV8.Node<K, V> node = f.find(hash, evict.getKey());
      V prevValue = node.val;
      ^^^ node can be null here
      if (prevValue != BoundedEquivalentConcurrentHashMapV8.NULL_VALUE) {
      node.val = (V) BoundedEquivalentConcurrentHashMapV8.NULL_VALUE;

      Solution would be to check for null values here.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                genman Elias Ross
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: