]
Galder Zamarreño updated ISPN-8721:
-----------------------------------
Fix Version/s: 9.4.0.Final
(was: 9.3.0.Final)
Clustered 2nd level cache sometimes throws NullPointerException when
new node starts up
---------------------------------------------------------------------------------------
Key: ISPN-8721
URL:
https://issues.jboss.org/browse/ISPN-8721
Project: Infinispan
Issue Type: Bug
Components: Hibernate Cache
Affects Versions: 9.1.4.Final
Environment: jvm 1.8
Reporter: Tom Dearman
Assignee: Tom Dearman
Fix For: 9.4.0.Final
Attachments: sample-app.cache.tar.gz
There is a race condition in PutFromLoadValidator as it registers itself in the component
registry before it is fully initialised. You can reproduce this by running the contained
app against h2 server db. First start this app with default port. Then start the app on
port '8080' and make a few requests to '/add' to create data. After that
send continuous requests to '/update' in order change data and trigger the cache:
for i in
{code}
{1..1000}
; do sleep 0.01; curl
http://localhost:8080/update -X POST; done
{code}
Then start another instance of the app on port 8090:
{code}
java -jar test-app-0.0.1-SNAPSHOT.jar --server.port=8090
{code}
Most of the time one of the updates will fail and the logs will show the following:
{code}
2018-01-23 15:36:46 [main] DEBUG o.h.c.i.access.PutFromLoadValidator - Interceptor chain
was: [org.infinispan.interceptors.InvocationContextInterceptor@407a7f2a,
org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor@4ea5b703,
org.infinispan.interceptors.EntryWrappingInterceptor@2a7ed1f,
org.infinispan.interceptors.InvalidationInterceptor@3fa247d1,
org.infinispan.interceptors.CallInterceptor@2cb2fc20]
2018-01-23 15:36:46 [main] DEBUG o.h.c.i.access.PutFromLoadValidator - New interceptor
chain is: [org.infinispan.interceptors.InvocationContextInterceptor@407a7f2a,
org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor@4ea5b703,
org.hibernate.cache.infinispan.access.NonTxPutFromLoadInterceptor@495ee280,
org.infinispan.interceptors.EntryWrappingInterceptor@2a7ed1f,
org.hibernate.cache.infinispan.access.NonTxInvalidationInterceptor@4fa1c212,
org.infinispan.interceptors.CallInterceptor@2cb2fc20]
2018-01-23 15:36:46 [main] TRACE o.i.manager.DefaultCacheManager - About to wire and
start cache test.app.data.User-pending-puts
2018-01-23 15:36:46 [remote-thread--p2-t1] ERROR o.i.i.InvocationContextInterceptor -
ISPN000136: Error executing command BeginInvalidationCommand, writing keys
test.app.data.User#2
java.lang.NullPointerException: null
at
org.hibernate.cache.infinispan.access.PutFromLoadValidator.beginInvalidatingWithPFER(PutFromLoadValidator.java:561)
at
org.hibernate.cache.infinispan.access.PutFromLoadValidator.beginInvalidatingKey(PutFromLoadValidator.java:555)
at
org.hibernate.cache.infinispan.access.NonTxPutFromLoadInterceptor.visitInvalidateCommand(NonTxPutFromLoadInterceptor.java:70)
at
org.infinispan.commands.write.InvalidateCommand.acceptVisitor(InvalidateCommand.java:114)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:99)
at
org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitInvalidateCommand(AbstractLockingInterceptor.java:112)
at
org.infinispan.commands.write.InvalidateCommand.acceptVisitor(InvalidateCommand.java:114)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:99)
at
org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:110)
at
org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:79)
at
org.infinispan.commands.AbstractVisitor.visitInvalidateCommand(AbstractVisitor.java:127)
at
org.infinispan.commands.write.InvalidateCommand.acceptVisitor(InvalidateCommand.java:114)
at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:335)
at
org.infinispan.commands.remote.BaseRpcInvokingCommand.processVisitableCommand(BaseRpcInvokingCommand.java:43)
at org.infinispan.commands.remote.SingleRpcCommand.perform(SingleRpcCommand.java:51)
at
org.infinispan.remoting.inboundhandler.BasePerCacheInboundInvocationHandler.invokePerform(BasePerCacheInboundInvocationHandler.java:92)
at
org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.run(BaseBlockingRunnable.java:34)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2018-01-23 15:36:47 [main] TRACE o.i.manager.DefaultCacheManager - Closing latch for
cache test.app.data.User-pending-puts
{code}