]
Dan Berindei closed ISPN-7157.
------------------------------
Resolution: Out of Date
LIRS support was removed in 9.0
NPE possible in cache eviction 'HIR_NONRESIDENT'
------------------------------------------------
Key: ISPN-7157
URL:
https://issues.redhat.com/browse/ISPN-7157
Project: Infinispan
Issue Type: Bug
Components: Core
Affects Versions: 8.2.2.Final
Reporter: Elias Ross
Priority: Major
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.