ArrayIndexOutOfBoundsException in case of using off-heap storage together with lifespan property
cslysy Jun 5, 2017 8:39 AMI would like to configure Infinispan ( infinispan-embedded-9.0.1.Final) in a way that entries will be stored in off-heap memory and removed after configured time. The point is that after running following piece of code I end up with ArrayIndexOutOfBoundsException:
Code:
EmbeddedCacheManager cacheManager = new DefaultCacheManager();
cacheManager.defineConfiguration(
"my-cache",
new ConfigurationBuilder()
.memory()
.storageType(StorageType.OFF_HEAP).size(10000)
.expiration().lifespan(30, TimeUnit.SECONDS)
.build()
);
cacheManager.getCache("my-cache").put("testKey", "testValue");
Result:
Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.infinispan.container.offheap.OffHeapEntryFactoryImpl.create(OffHeapEntryFactoryImpl.java:98)
at org.infinispan.container.offheap.OffHeapDataContainer.put(OffHeapDataContainer.java:167)
at org.infinispan.container.offheap.BoundedOffHeapDataContainer.put(BoundedOffHeapDataContainer.java:45)
at org.infinispan.container.offheap.BoundedOffHeapDataContainer.put(BoundedOffHeapDataContainer.java:21)
at org.infinispan.container.entries.ReadCommittedEntry.commit(ReadCommittedEntry.java:146)
at org.infinispan.statetransfer.CommitManager.commit(CommitManager.java:95)
at org.infinispan.interceptors.locking.ClusteringDependentLogic$LocalLogic.commitSingleEntry(ClusteringDependentLogic.java:385)
at org.infinispan.interceptors.locking.ClusteringDependentLogic$AbstractClusteringDependentLogic.commitEntry(ClusteringDependentLogic.java:186)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitContextEntry(EntryWrappingInterceptor.java:590)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitEntryIfNeeded(EntryWrappingInterceptor.java:805)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitContextEntries(EntryWrappingInterceptor.java:567)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.applyChanges(EntryWrappingInterceptor.java:623)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.lambda$setSkipRemoteGetsAndInvokeNextForDataCommand$8(EntryWrappingInterceptor.java:680)
at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextThenAccept(BaseAsyncInterceptor.java:108)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand(EntryWrappingInterceptor.java:676)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.visitPutKeyValueCommand(EntryWrappingInterceptor.java:304)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:74)
at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndFinally(BaseAsyncInterceptor.java:153)
at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitNonTxDataWriteCommand(AbstractLockingInterceptor.java:116)
at org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor.visitDataWriteCommand(NonTransactionalLockingInterceptor.java:39)
at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitPutKeyValueCommand(AbstractLockingInterceptor.java:77)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:74)
at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext(BaseAsyncInterceptor.java:57)
at org.infinispan.interceptors.impl.CacheMgmtInterceptor.updateStoreStatistics(CacheMgmtInterceptor.java:171)
at org.infinispan.interceptors.impl.CacheMgmtInterceptor.visitPutKeyValueCommand(CacheMgmtInterceptor.java:160)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:74)
at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndExceptionally(BaseAsyncInterceptor.java:126)
This issue is strictly related to off-heap storage type - when I set it to StorageType.BINARY then everything works fine.
Could you please take a look and verify if my configuration is wrong or there is a bug in Infinispan?