]
Galder Zamarreño updated ISPN-4746:
-----------------------------------
Affects Version/s: 6.0.2.Final
NPE when preloading cache with DeltaAware values
------------------------------------------------
Key: ISPN-4746
URL:
https://issues.jboss.org/browse/ISPN-4746
Project: Infinispan
Issue Type: Bug
Components: Core
Affects Versions: 6.0.2.Final, 7.0.0.Beta2
Reporter: Gustavo Fernandes
Assignee: Gustavo Fernandes
{code:java}
public class DeltaAwarePreloadTest extends MultipleCacheManagersTest {
private static final int CLUSTER_SIZE = 1;
@Override
protected void createCacheManagers() throws Throwable {
ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC,
false);
c.persistence().addStore(new
DummyInMemoryStoreConfigurationBuilder(c.persistence()).storeName(getClass().getSimpleName())).preload(true);
createCluster(c, CLUSTER_SIZE);
waitForClusterToForm();
}
@Test
public void testPreloadOnStart() throws PersistenceException {
Cache<Object, Object> cache = caches().get(0);
cache.put(1, new TestDeltaAware());
cache.stop();
cache.start();
}
}
{code}
During preload, the {{NonTxDistributionInterceptor}} decides that is requires values from
previous owners and tries to check if the local node is the primary owner. At this point,
the WriteCH is null since no topology was ever updated. Here's the stacktrace:
{code}
Caused by: org.infinispan.persistence.spi.PersistenceException: Unable to preload!
at
org.infinispan.persistence.manager.PersistenceManagerImpl.preloadKey(PersistenceManagerImpl.java:620)
at
org.infinispan.persistence.manager.PersistenceManagerImpl.access$000(PersistenceManagerImpl.java:70)
at
org.infinispan.persistence.manager.PersistenceManagerImpl$1.processEntry(PersistenceManagerImpl.java:228)
at
org.infinispan.persistence.dummy.DummyInMemoryStore.process(DummyInMemoryStore.java:165)
at
org.infinispan.persistence.manager.PersistenceManagerImpl.preload(PersistenceManagerImpl.java:220)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168)
... 37 more
Caused by: java.lang.NullPointerException
at
org.infinispan.distribution.impl.DistributionManagerImpl.getWriteConsistentHash(DistributionManagerImpl.java:115)
at
org.infinispan.distribution.impl.DistributionManagerImpl.getConsistentHash(DistributionManagerImpl.java:105)
at
org.infinispan.distribution.impl.DistributionManagerImpl.getPrimaryLocation(DistributionManagerImpl.java:95)
at
org.infinispan.interceptors.locking.ClusteringDependentLogic$DistributionLogic.localNodeIsPrimaryOwner(ClusteringDependentLogic.java:395)
at
org.infinispan.interceptors.distribution.NonTxDistributionInterceptor.remoteGetBeforeWrite(NonTxDistributionInterceptor.java:131)
at
org.infinispan.interceptors.distribution.BaseDistributionInterceptor.handleNonTxWriteCommand(BaseDistributionInterceptor.java:195)
at
org.infinispan.interceptors.distribution.NonTxDistributionInterceptor.visitPutKeyValueCommand(NonTxDistributionInterceptor.java:72)
at
org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:71)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
at
org.infinispan.interceptors.DistCacheWriterInterceptor.visitPutKeyValueCommand(DistCacheWriterInterceptor.java:72)
at
org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:71)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
at
org.infinispan.interceptors.CacheLoaderInterceptor.visitPutKeyValueCommand(CacheLoaderInterceptor.java:113)
at
org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:71)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
at
org.infinispan.interceptors.EntryWrappingInterceptor.invokeNextAndApplyChanges(EntryWrappingInterceptor.java:376)
at
org.infinispan.interceptors.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand(EntryWrappingInterceptor.java:464)
{code}