]
Dan Berindei reassigned ISPN-4334:
----------------------------------
Assignee: (was: Vladimir Blagojevic)
MapReduceTaskLifecycleService shouldn't keep the list of found
lifecycle implementations
----------------------------------------------------------------------------------------
Key: ISPN-4334
URL:
https://issues.jboss.org/browse/ISPN-4334
Project: Infinispan
Issue Type: Bug
Components: Distributed Execution and Map/Reduce, Remote Querying
Reporter: Jakub Markos
The issue is that this class
https://github.com/infinispan/infinispan/blob/master/core/src/main/java/o...
searches for the lifecycle classes using current threads classloader, and then caches the
result, so the returned list of implementations depends only on the 1st thread creating
the singleton instance of the service.
You can replicate the bug from this branch:
https://github.com/jmarkos/infinispan/tree/queries
running
{code}
mvn clean verify -Dmaven.test.failure.ignore=true -DfailIfNoTests=false -U
-Psuite.others -Dtest=RemoteQueryKeySetTest,ManualIndexingTest
{code}
from the server/integration/testsuite directory, results in an exception:
{code}javax.management.MBeanException
at org.infinispan.jmx.ResourceDMBean.invoke(ResourceDMBean.java:271)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791)
at
org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:527)
at
org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:263)
at
org.jboss.remotingjmx.protocol.v2.ServerProxy$InvokeHandler.handle(ServerProxy.java:915)
at
org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1.run(ServerCommon.java:152)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
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:601)
at org.infinispan.jmx.ResourceDMBean.invoke(ResourceDMBean.java:269)
... 9 more
Caused by: org.infinispan.commons.CacheException:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at
org.infinispan.distexec.mapreduce.MapReduceTask.executeHelper(MapReduceTask.java:517)
at
org.infinispan.distexec.mapreduce.MapReduceTask.execute(MapReduceTask.java:427)
at
org.infinispan.query.impl.massindex.MapReduceMassIndexer.start(MapReduceMassIndexer.java:25)
... 14 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at
org.infinispan.distexec.mapreduce.MapReduceTask$TaskPart.get(MapReduceTask.java:1059)
at
org.infinispan.distexec.mapreduce.MapReduceTask.executeMapPhaseWithLocalReduction(MapReduceTask.java:677)
at
org.infinispan.distexec.mapreduce.MapReduceTask.executeHelper(MapReduceTask.java:510)
... 16 more
Caused by: java.lang.NullPointerException
at
org.infinispan.query.impl.massindex.IndexingMapper.map(IndexingMapper.java:38)
at
org.infinispan.distexec.mapreduce.MapReduceManagerImpl$2.apply(MapReduceManagerImpl.java:207)
at
org.infinispan.distexec.mapreduce.MapReduceManagerImpl$2.apply(MapReduceManagerImpl.java:202)
at
org.infinispan.container.DefaultDataContainer$1.apply(DefaultDataContainer.java:393)
at
org.infinispan.container.DefaultDataContainer$1.apply(DefaultDataContainer.java:389)
at
org.infinispan.commons.util.concurrent.jdk8backported.ConcurrentParallelHashMapV8$1.apply(ConcurrentParallelHashMapV8.java:48)
at
org.infinispan.commons.util.concurrent.jdk8backported.EquivalentConcurrentHashMapV8$ForEachMappingTask.compute(EquivalentConcurrentHashMapV8.java:4894)
at
org.infinispan.commons.util.concurrent.jdk8backported.CountedCompleter.exec(CountedCompleter.java:681)
at
org.infinispan.commons.util.concurrent.jdk8backported.ForkJoinTask.doExec(ForkJoinTask.java:264)
at
org.infinispan.commons.util.concurrent.jdk8backported.ForkJoinTask.doInvoke(ForkJoinTask.java:360)
at
org.infinispan.commons.util.concurrent.jdk8backported.ForkJoinTask.invoke(ForkJoinTask.java:692)
at
org.infinispan.commons.util.concurrent.jdk8backported.EquivalentConcurrentHashMapV8.forEach(EquivalentConcurrentHashMapV8.java:3592)
at
org.infinispan.commons.util.concurrent.jdk8backported.ConcurrentParallelHashMapV8.forEach(ConcurrentParallelHashMapV8.java:44)
at
org.infinispan.container.DefaultDataContainer.executeTask(DefaultDataContainer.java:389)
at
org.infinispan.distexec.mapreduce.MapReduceManagerImpl.map(MapReduceManagerImpl.java:202)
at
org.infinispan.distexec.mapreduce.MapReduceManagerImpl.mapAndCombineForLocalReduction(MapReduceManagerImpl.java:87)
at
org.infinispan.distexec.mapreduce.MapReduceTask$MapTaskPart.invokeMapCombineLocallyForLocalReduction(MapReduceTask.java:1173)
at
org.infinispan.distexec.mapreduce.MapReduceTask$MapTaskPart.access$300(MapReduceTask.java:1112)
at
org.infinispan.distexec.mapreduce.MapReduceTask$MapTaskPart$2.call(MapReduceTask.java:1144)
at
org.infinispan.distexec.mapreduce.MapReduceTask$MapTaskPart$2.call(MapReduceTask.java:1140)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
{code}
If you instead use -Dtest=RemoteQueryKeySetTest,ManualIndexingggggggggggggTest (to
change the order of the execution, junit probably orders it by length), it passes, because
MapReduceTaskLifecycleService is created from a thread which classloader sees the query
module and therefore can load this class
https://github.com/infinispan/infinispan/blob/master/query/src/main/java/...
which properly initializes IndexingMapper and avoids the NPE.
Thanks to Adrian Nistor for his help.