You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/06/18 01:54:02 UTC

[GitHub] [shardingsphere-elasticjob-lite] hujunzhong opened a new issue #787: shutdownInstance空指针

hujunzhong opened a new issue #787:
URL: https://github.com/apache/shardingsphere-elasticjob-lite/issues/787


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere-elastic-job-lite/issues).
   - Read documentation: [ElasticJob Doc](http://elasticjob.io/docs/elastic-job-lite/00-overview/).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ElasticJob did you use?
   2.1.5
   ### Which project did you use? ElasticJob-Lite or ElasticJob-Cloud?
    ElasticJob-Lite
   ### Expected behavior
   shutdownInstance正常关闭
   ### Actual behavior
   异常:
   
   java.lang.NullPointerException
   	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
   	at com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry.getRegCenter(JobRegistry.java:95)
   	at com.dangdang.ddframe.job.lite.internal.schedule.JobShutdownHookPlugin.shutdown(JobShutdownHookPlugin.java:28)
   	at org.quartz.core.QuartzScheduler.shutdownPlugins(QuartzScheduler.java:2335)
   	at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:712)
   	at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:628)
   	at org.quartz.impl.StdScheduler.shutdown(StdScheduler.java:198)
   	at com.dangdang.ddframe.job.lite.internal.schedule.JobScheduleController.shutdown(JobScheduleController.java:139)
   	at com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry.shutdown(JobRegistry.java:168)
   	at com.dangdang.ddframe.job.lite.internal.schedule.SchedulerFacade.shutdownInstance(SchedulerFacade.java:135)
   	at com.jlx.own.price.schedule.elastic.ElasticJobRegisterTest.testMuliRegister(ElasticJobRegisterTest.java:34)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
   	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
   	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
   	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
   	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
   	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
   	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
   	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
   	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
   	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
   	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
   	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
   	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
   	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
   	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
   	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
   	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
   	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
   ### Reason analyze (If you can)
   ### Steps to reproduce the behavior.
   
   JobScheduler job = new JobScheduler(regCenter, planJobConfig);
   job.init();
   job.getSchedulerFacade().shutdownInstance();
   
   ### Example codes for reproduce this issue (such as a github link).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob-lite] hujunzhong commented on issue #787: shutdownInstance空指针

Posted by GitBox <gi...@apache.org>.
hujunzhong commented on issue #787:
URL: https://github.com/apache/shardingsphere-elasticjob-lite/issues/787#issuecomment-645861782


   quartz版本问题


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob-lite] hujunzhong closed issue #787: shutdownInstance空指针

Posted by GitBox <gi...@apache.org>.
hujunzhong closed issue #787:
URL: https://github.com/apache/shardingsphere-elasticjob-lite/issues/787


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob-lite] mmx1960 commented on issue #787: shutdownInstance空指针

Posted by GitBox <gi...@apache.org>.
mmx1960 commented on issue #787:
URL: https://github.com/apache/shardingsphere-elasticjob-lite/issues/787#issuecomment-645754623


   place confirm the field `jobName`  have been setted in  your planJobConfig instance. if you're sure about that , give more code  can help to resolve your issue


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob-lite] hujunzhong commented on issue #787: shutdownInstance空指针

Posted by GitBox <gi...@apache.org>.
hujunzhong commented on issue #787:
URL: https://github.com/apache/shardingsphere-elasticjob-lite/issues/787#issuecomment-645797694


   		ZookeeperConfiguration zkConfig = new ZookeeperConfiguration(zkAddress, "elastic-job-price_source");
           String jobName = "test";
           CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(zkConfig);
           regCenter.init();
           JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(jobName, "0/1 * * * * ?", 1).build();
           SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, TestJob.class.getCanonicalName());
           LiteJobConfiguration planJobConfig = LiteJobConfiguration.newBuilder(simpleJobConfig).overwrite(true).build();
           JobScheduler job = new JobScheduler(regCenter, planJobConfig);
           job.init();
   		job.getSchedulerFacade().shutdownInstance();


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob-lite] hujunzhong commented on issue #787: shutdownInstance空指针

Posted by GitBox <gi...@apache.org>.
hujunzhong commented on issue #787:
URL: https://github.com/apache/shardingsphere-elasticjob-lite/issues/787#issuecomment-645839526


   @mmx1960 
   
   失败转移的时候也出现同样的异常:
   2020-06-18 14:25:23.249 ERROR [Job-rt|top50|latest_Worker-1] c.d.d.j.e.h.i.DefaultJobExceptionHandler.?:? QTraceId[] Job 'Job-rt|top50|latest' exception occur in job processing
   java.lang.RuntimeException: plan没注册成功Job-rt|top50|latest
           at com.jlx.own.price.schedule.elastic.ElasticPlanJob.execute(ElasticPlanJob.java:26)
           at com.dangdang.ddframe.job.executor.type.SimpleJobExecutor.process(SimpleJobExecutor.java:41)
           at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.process(AbstractElasticJobExecutor.java:206)
           at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.process(AbstractElasticJobExecutor.java:171)
           at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:150)
           at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:125)
           at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26)
           at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
           at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
   2020-06-18 14:25:23.346 ERROR [Curator-TreeCache-23] o.a.c.f.r.c.TreeCache.?:? QTraceId[]
   java.lang.NullPointerException: null
           at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
           at com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry.getRegCenter(JobRegistry.java:95)
           at com.dangdang.ddframe.job.lite.internal.schedule.JobShutdownHookPlugin.shutdown(JobShutdownHookPlugin.java:28)
           at org.quartz.core.QuartzScheduler.shutdownPlugins(QuartzScheduler.java:2335)
           at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:712)
           at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:628)
           at org.quartz.impl.StdScheduler.shutdown(StdScheduler.java:198)
           at com.dangdang.ddframe.job.lite.internal.schedule.JobScheduleController.shutdown(JobScheduleController.java:139)
           at com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry.shutdown(JobRegistry.java:168)
           at com.dangdang.ddframe.job.lite.internal.schedule.SchedulerFacade.shutdownInstance(SchedulerFacade.java:135)
           at com.dangdang.ddframe.job.lite.internal.instance.ShutdownListenerManager$InstanceShutdownStatusJobListener.dataChanged(ShutdownListenerManager.java:61)
           at com.dangdang.ddframe.job.lite.internal.listener.AbstractJobListener.childEvent(AbstractJobListener.java:44)
           at org.apache.curator.framework.recipes.cache.TreeCache$2.apply(TreeCache.java:732)
           at org.apache.curator.framework.recipes.cache.TreeCache$2.apply(TreeCache.java:726)
           at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:93)
           at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
           at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:85)
           at org.apache.curator.framework.recipes.cache.TreeCache.callListeners(TreeCache.java:725)
           at org.apache.curator.framework.recipes.cache.TreeCache.access$1400(TreeCache.java:71)
   		at org.apache.curator.framework.recipes.cache.TreeCache$4.run(TreeCache.java:843)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           at java.lang.Thread.run(Thread.java:745)
   
   SimpleJob代码如下:
   @Slf4j
   public class ElasticPlanJob implements SimpleJob {
       @Override
       public void execute(ShardingContext shardingContext) {
           QTraceScope qtraceClient = QTraceClientGetter.getClient().startTrace("ElasticPlanJob");
           try{
               String planName = shardingContext.getJobName();
               QMonitor.recordOne("plan_job_schedule_" + planName);
               QMonitor.recordOne("plan_job_schedule");
               Plan plan = ElasticPlanJobManager.getInstance().findPlan(planName);
               if(plan == null){
                   log.error("plan调度失败,没找到对应plan:{}", planName);
                   throw new RuntimeException("plan没注册成功" + planName);
               }
   
               log.info("开始执行:{}", planName);
               plan.execute();
           } finally {
               if(qtraceClient != null){
                   qtraceClient.close();
               }
           }
       }
   }


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob-lite] hujunzhong removed a comment on issue #787: shutdownInstance空指针

Posted by GitBox <gi...@apache.org>.
hujunzhong removed a comment on issue #787:
URL: https://github.com/apache/shardingsphere-elasticjob-lite/issues/787#issuecomment-645839526


   @mmx1960 
   
   失败转移的时候也出现同样的异常:
   2020-06-18 14:25:23.249 ERROR [Job-rt|top50|latest_Worker-1] c.d.d.j.e.h.i.DefaultJobExceptionHandler.?:? QTraceId[] Job 'Job-rt|top50|latest' exception occur in job processing
   java.lang.RuntimeException: plan没注册成功Job-rt|top50|latest
           at com.jlx.own.price.schedule.elastic.ElasticPlanJob.execute(ElasticPlanJob.java:26)
           at com.dangdang.ddframe.job.executor.type.SimpleJobExecutor.process(SimpleJobExecutor.java:41)
           at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.process(AbstractElasticJobExecutor.java:206)
           at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.process(AbstractElasticJobExecutor.java:171)
           at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:150)
           at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:125)
           at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26)
           at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
           at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
   2020-06-18 14:25:23.346 ERROR [Curator-TreeCache-23] o.a.c.f.r.c.TreeCache.?:? QTraceId[]
   java.lang.NullPointerException: null
           at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
           at com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry.getRegCenter(JobRegistry.java:95)
           at com.dangdang.ddframe.job.lite.internal.schedule.JobShutdownHookPlugin.shutdown(JobShutdownHookPlugin.java:28)
           at org.quartz.core.QuartzScheduler.shutdownPlugins(QuartzScheduler.java:2335)
           at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:712)
           at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:628)
           at org.quartz.impl.StdScheduler.shutdown(StdScheduler.java:198)
           at com.dangdang.ddframe.job.lite.internal.schedule.JobScheduleController.shutdown(JobScheduleController.java:139)
           at com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry.shutdown(JobRegistry.java:168)
           at com.dangdang.ddframe.job.lite.internal.schedule.SchedulerFacade.shutdownInstance(SchedulerFacade.java:135)
           at com.dangdang.ddframe.job.lite.internal.instance.ShutdownListenerManager$InstanceShutdownStatusJobListener.dataChanged(ShutdownListenerManager.java:61)
           at com.dangdang.ddframe.job.lite.internal.listener.AbstractJobListener.childEvent(AbstractJobListener.java:44)
           at org.apache.curator.framework.recipes.cache.TreeCache$2.apply(TreeCache.java:732)
           at org.apache.curator.framework.recipes.cache.TreeCache$2.apply(TreeCache.java:726)
           at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:93)
           at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
           at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:85)
           at org.apache.curator.framework.recipes.cache.TreeCache.callListeners(TreeCache.java:725)
           at org.apache.curator.framework.recipes.cache.TreeCache.access$1400(TreeCache.java:71)
   		at org.apache.curator.framework.recipes.cache.TreeCache$4.run(TreeCache.java:843)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           at java.lang.Thread.run(Thread.java:745)
   
   SimpleJob代码如下:
   @Slf4j
   public class ElasticPlanJob implements SimpleJob {
       @Override
       public void execute(ShardingContext shardingContext) {
           QTraceScope qtraceClient = QTraceClientGetter.getClient().startTrace("ElasticPlanJob");
           try{
               String planName = shardingContext.getJobName();
               QMonitor.recordOne("plan_job_schedule_" + planName);
               QMonitor.recordOne("plan_job_schedule");
               Plan plan = ElasticPlanJobManager.getInstance().findPlan(planName);
               if(plan == null){
                   log.error("plan调度失败,没找到对应plan:{}", planName);
                   throw new RuntimeException("plan没注册成功" + planName);
               }
   
               log.info("开始执行:{}", planName);
               plan.execute();
           } finally {
               if(qtraceClient != null){
                   qtraceClient.close();
               }
           }
       }
   }


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org