为什么cacheLoadOnlyStoreAdapter在加载期间会抛出NPE?

时间:2019-04-02 06:00:51

标签: ignite

我们从2.4.0切换到2.7.0。是什么原因造成的?我不能排除代码中的问题,但我们不在堆栈中。

  

22:39:36.270 [mgmt-#66]错误o.a.i.i.p.task.GridTaskWorker-失败   获取远程作业结果策略以获取结果   ComputeTask.result(..)方法(将使整个任务失败):   GridJobResultImpl [job = C2 [c = LoadCacheJobV2 [keepBinary = false]],   sib = GridJobSiblingImpl   [sesId = 6461c7cd961-d4d7605d-33c7-4941-84bc-f6eca074593f,   jobId = 7461c7cd961-d4d7605d-33c7-4941-84bc-f6eca074593f,   nodeId = 503c524c-c53a-4f98-aadd-4c95ac2b168b,isJobDone = false],   jobCtx = GridJobContextImpl   [jobId = 7461c7cd961-d4d7605d-33c7-4941-84bc-f6eca074593f,   timeoutObj = null,attrs = {}],node = TcpDiscoveryNode   [id = 503c524c-c53a-4f98-aadd-4c95ac2b168b,addrs = [127.0.0.1,   172.17.0.2],sockAddrs = [/ 127.0.0.1:47500,/   172.17.0.2:47500]、discPort=47500、order=1、intOrder=1、lastExchangeTime=1554182314332、loc=false,   ver = 2.4.0#20180305-sha1:aa342270,isClient = false],ex = class   o.a.i.IgniteException:null,hasRes = true,isCancelled = false,   isOccupied = true] org.apache.ignite.IgniteException:远程作业被抛出   用户异常(如果覆盖,请重写或实现ComputeTask.result(..)方法   您想针对此异常进行自动故障转移)。       在org.apache.ignite.compute.ComputeTaskAdapter.result(ComputeTaskAdapter.java:101)       在org.apache.ignite.internal.processors.task.GridTaskWorker $ 5.apply(GridTaskWorker.java:1047)       在org.apache.ignite.internal.processors.task.GridTaskWorker $ 5.apply(GridTaskWorker.java:1040)       在org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6655)       在org.apache.ignite.internal.processors.task.GridTaskWorker.result(GridTaskWorker.java:1040)       在org.apache.ignite.internal.processors.task.GridTaskWorker.onResponse(GridTaskWorker.java:858)       在org.apache.ignite.internal.processors.task.GridTaskProcessor.processJobExecuteResponse(GridTaskProcessor.java:1077)       在org.apache.ignite.internal.processors.task.GridTaskProcessor $ JobMessageListener.onMessage(GridTaskProcessor.java:1312)       在org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1555)       在org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1183)       在org.apache.ignite.internal.managers.communication.GridIoManager.access $ 4200(GridIoManager.java:126)       在org.apache.ignite.internal.managers.communication.GridIoManager $ 9.run(GridIoManager.java:1090)       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)       在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)       在java.lang.Thread.run(Thread.java:748)导致原因:org.apache.ignite.IgniteException:null       在org.apache.ignite.internal.processors.closure.GridClosureProcessor $ C2.execute(GridClosureProcessor.java:1858)       在org.apache.ignite.internal.processors.job.GridJobWorker $ 2.call(GridJobWorker.java:566)       在org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6623)       在org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:560)       在org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:489)       在org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)       在org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1123)       在org.apache.ignite.internal.processors.job.GridJobProcessor $ JobExecutionListener.onMessage(GridJobProcessor.java:1921)处       ...省略了7个通用框架       引起原因:org.apache.ignite.IgniteException:空       在org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:980)       在org.apache.ignite.internal.processors.cache.GridCacheAdapter $ LoadCacheJob.localExecute(GridCacheAdapter.java:5525)       在org.apache.ignite.internal.processors.cache.GridCacheAdapter $ LoadCacheJobV2.localExecute(GridCacheAdapter.java:5569)       在org.apache.ignite.internal.processors.cache.GridCacheAdapter $ TopologyVersionAwareJob.execute(GridCacheAdapter.java:6184)       在org.apache.ignite.compute.ComputeJobAdapter.call(ComputeJobAdapter.java:132)       在org.apache.ignite.internal.processors.closure.GridClosureProcessor $ C2.execute(GridClosureProcessor.java:1855)

     

...省略了14个通用框架       原因:org.apache.ignite.IgniteCheckedException:空       在org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7244)       在org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.sessionEnd0(GridCacheStoreManagerAdapter.java:943)       在org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadCache(GridCacheStoreManagerAdapter.java:549)       在org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.localLoadCache(GridDhtCacheAdapter.java:608)       在org.apache.ignite.internal.processors.cache.GridCacheProxyImpl.localLoadCache(GridCacheProxyImpl.java:217)       在org.apache.ignite.internal.processors.cache.GridCacheAdapter $ LoadCacheJob.localExecute(GridCacheAdapter.java:5520)

     

...省略了18个常见框架原因:java.lang.NullPointerException:null       在org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter $ SessionData.access $ 900(GridCacheStoreManagerAdapter.java:964)       在org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.sessionEnd0(GridCacheStoreManagerAdapter.java:937)

     

... 22个共同的框架被省略       22:39:36.293 [pool-3-thread-1]       错误c.b.a.c.c.i.cache.CeresCacheManager-加载缓存ceres-daily-2019-02-27的数据时出现问题。问题: ()   java.lang.NullPointerException:空       在org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter $ SessionData.access $ 900(GridCacheStoreManagerAdapter.java:964)       在org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.sessionEnd0(GridCacheStoreManagerAdapter.java:937)       在org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadCache(GridCacheStoreManagerAdapter.java:549)       在org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.localLoadCache(GridDhtCacheAdapter.java:608)       在org.apache.ignite.internal.processors.cache.GridCacheProxyImpl.localLoadCache(GridCacheProxyImpl.java:217)       在org.apache.ignite.internal.processors.cache.GridCacheAdapter $ LoadCacheJob.localExecute(GridCacheAdapter.java:5520)       在org.apache.ignite.internal.processors.cache.GridCacheAdapter $ LoadCacheJobV2.localExecute(GridCacheAdapter.java:5569)       在org.apache.ignite.internal.processors.cache.GridCacheAdapter $ TopologyVersionAwareJob.execute(GridCacheAdapter.java:6184)       在org.apache.ignite.compute.ComputeJobAdapter.call(ComputeJobAdapter.java:132)       在org.apache.ignite.internal.processors.closure.GridClosureProcessor $ C2.execute(GridClosureProcessor.java:1855)       在org.apache.ignite.internal.processors.job.GridJobWorker $ 2.call(GridJobWorker.java:566)       在org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6623)       在org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:560)       在org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:489)       在org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)       在org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1123)       在org.apache.ignite.internal.processors.job.GridJobProcessor $ JobExecutionListener.onMessage(GridJobProcessor.java:1921)处       在org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1555)       在org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1183)       在org.apache.ignite.internal.managers.communication.GridIoManager.access $ 4200(GridIoManager.java:126)       在org.apache.ignite.internal.managers.communication.GridIoManager $ 9.run(GridIoManager.java:1090)       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)       在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)       在java.lang.Thread.run(Thread.java:748)

public class XYZLoader
    extends CacheLoadOnlyStoreAdapter<XYZKey, byte[], XYZRecord>
    implements ComputeJob, Serializable {

    public XYZLoader(...) {

        reconfigureCacheLoadOnlyStoreAdapter(gridNodePhysicalThreadCount, externalParallelism);

    }

    private void reconfigureCacheLoadOnlyStoreAdapter(int gridNodePhysicalThreadCount, int externalParallelism) {
        int physicalThreadCount = ...

        this.setBatchSize(...);
        this.setBatchQueueSize(...);
        this.setThreadsCount(...);
    }

    int[] getLocalPartitions(Ignite ignite) {
        //...
        return ...;
    }

    @Override
    protected Iterator<XYZRecord> inputIterator(@Nullable Object... args) throws CacheLoaderException {
        int[] parts = getLocalPartitions(ignite);
        IgniteCluster cluster = ignite.cluster();
        ClusterNode localNode = cluster.localNode();
        int partitionCount = ignite.affinity(dataloadDescriptor.cacheName).partitions();

        Iterator<XYZRecord> reader = new XYZReader(parts, ...);

        iteratorFinishedFlag = false;

        return new Iterator<XYZRecord>() {
            // wrap inner iterator reader here..
        };
    }

    protected IgniteBiTuple<XYZKey, byte[]> parse(XYZRecord rec, @Nullable Object... args) {
        // parsing foo...
        return record;
    }

    @IgniteInstanceResource
    public void setIgnite(Ignite ignite) {
        this.ignite = ignite;
    }

    @Override // ComputeJob
    public void cancel() {
        throw new RuntimeException("Not implemented");
    }

    @Override // ComputeJob
    public Object execute() throws IgniteException {
        throw new RuntimeException("Not implemented");
    }

    @TaskSessionResource
    public void setTaskSession(ComputeTaskSession taskSes) {
        ComputeTaskSession ses = taskSes;
        logger.info(... ses);
    }
}

1 个答案:

答案 0 :(得分:0)

我敢打赌,您忘记在CacheStore实现中的某个地方调用super.method(),从而导致基础数据结构的部分初始化。可能是在loadCache()或loadFromStore()中。