apache / shardingsphere-elasticjob

Distributed scheduled job
Apache License 2.0
8.15k stars 3.29k forks source link

报错请问是为什么 #668

Closed wasd345 closed 5 years ago

wasd345 commented 5 years ago

Please answer these questions before submitting your issue. Thanks! 开源不易,我们希望将精力放在完成新功能和解决有价值的问题上,为了让大家的配合更具有效率,请填写以下列出的全部问题

Which version of Elastic-Job do you using?(您使用的Elastic-Job版本为?)

2.1.5

Expected behavior (您预期的结果是)

linux部署后正常,不报错

Actual behavior (实际运行的结果是)

linux部署后,日志会打印报错

Steps to reproduce the behavior (可重现问题的操作步骤)

1:部署后一切都可以连接正常 2:但是服务器会报错,不知道什么原因到导致的 3:报错代码如下: 14:02:00 [DuizhangJob_Worker-1] ERROR org.quartz.core.JobRunShell - Job DEFAULT.DuizhangJob threw an unhandled Exception: com.dangdang.ddframe.job.reg.exception.RegException: java.lang.IllegalStateException: instance must be started before calling this method at com.dangdang.ddframe.job.reg.exception.RegExceptionHandler.handleException(RegExceptionHandler.java:52) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.getDirectly(ZookeeperRegistryCenter.java:162) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.get(ZookeeperRegistryCenter.java:143) at com.dangdang.ddframe.job.lite.internal.storage.JobNodeStorage.getJobNodeData(JobNodeStorage.java:72) at com.dangdang.ddframe.job.lite.internal.config.ConfigurationService.load(ConfigurationService.java:54) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.loadJobRootConfiguration(LiteJobFacade.java:78) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.loadJobRootConfiguration(LiteJobFacade.java:49) at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.(AbstractElasticJobExecutor.java:65) at com.dangdang.ddframe.job.executor.type.SimpleJobExecutor.(SimpleJobExecutor.java:35) at com.dangdang.ddframe.job.executor.JobExecutorFactory.getJobExecutor(JobExecutorFactory.java:51) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.lang.IllegalStateException: instance must be started before calling this method at com.google.common.base.Preconditions.checkState(Preconditions.java:173) at org.apache.curator.framework.imps.CuratorFrameworkImpl.getData(CuratorFrameworkImpl.java:375) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.getDirectly(ZookeeperRegistryCenter.java:158) ... 11 common frames omitted 14:02:00 [DuizhangJob_Worker-1] ERROR org.quartz.core.JobRunShell - Job DEFAULT.DuizhangJob threw an unhandled Exception: com.dangdang.ddframe.job.reg.exception.RegException: java.lang.IllegalStateException: instance must be started before calling this method at com.dangdang.ddframe.job.reg.exception.RegExceptionHandler.handleException(RegExceptionHandler.java:52) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.getDirectly(ZookeeperRegistryCenter.java:162) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.get(ZookeeperRegistryCenter.java:143) at com.dangdang.ddframe.job.lite.internal.storage.JobNodeStorage.getJobNodeData(JobNodeStorage.java:72) at com.dangdang.ddframe.job.lite.internal.config.ConfigurationService.load(ConfigurationService.java:54) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.loadJobRootConfiguration(LiteJobFacade.java:78) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.loadJobRootConfiguration(LiteJobFacade.java:49) at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.(AbstractElasticJobExecutor.java:65) at com.dangdang.ddframe.job.executor.type.SimpleJobExecutor.(SimpleJobExecutor.java:35) at com.dangdang.ddframe.job.executor.JobExecutorFactory.getJobExecutor(JobExecutorFactory.java:51) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.lang.IllegalStateException: instance must be started before calling this method at com.google.common.base.Preconditions.checkState(Preconditions.java:173) at org.apache.curator.framework.imps.CuratorFrameworkImpl.getData(CuratorFrameworkImpl.java:375) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.getDirectly(ZookeeperRegistryCenter.java:158) ... 11 common frames omitted 14:02:00 [DuizhangJob_Worker-1] ERROR org.quartz.core.ErrorLogger - Job (DEFAULT.DuizhangJob threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception. at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: com.dangdang.ddframe.job.reg.exception.RegException: java.lang.IllegalStateException: instance must be started before calling this method at com.dangdang.ddframe.job.reg.exception.RegExceptionHandler.handleException(RegExceptionHandler.java:52) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.getDirectly(ZookeeperRegistryCenter.java:162) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.get(ZookeeperRegistryCenter.java:143) at com.dangdang.ddframe.job.lite.internal.storage.JobNodeStorage.getJobNodeData(JobNodeStorage.java:72) at com.dangdang.ddframe.job.lite.internal.config.ConfigurationService.load(ConfigurationService.java:54) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.loadJobRootConfiguration(LiteJobFacade.java:78) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.loadJobRootConfiguration(LiteJobFacade.java:49) at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.(AbstractElasticJobExecutor.java:65) at com.dangdang.ddframe.job.executor.type.SimpleJobExecutor.(SimpleJobExecutor.java:35) at com.dangdang.ddframe.job.executor.JobExecutorFactory.getJobExecutor(JobExecutorFactory.java:51) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ... 1 common frames omitted Caused by: java.lang.IllegalStateException: instance must be started before calling this method at com.google.common.base.Preconditions.checkState(Preconditions.java:173) at org.apache.curator.framework.imps.CuratorFrameworkImpl.getData(CuratorFrameworkImpl.java:375) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.getDirectly(ZookeeperRegistryCenter.java:158) ... 11 common frames omitted 14:02:00 [DuizhangJob_Worker-1] ERROR org.quartz.core.ErrorLogger - Job (DEFAULT.DuizhangJob threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception. at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: com.dangdang.ddframe.job.reg.exception.RegException: java.lang.IllegalStateException: instance must be started before calling this method at com.dangdang.ddframe.job.reg.exception.RegExceptionHandler.handleException(RegExceptionHandler.java:52) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.getDirectly(ZookeeperRegistryCenter.java:162) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.get(ZookeeperRegistryCenter.java:143) at com.dangdang.ddframe.job.lite.internal.storage.JobNodeStorage.getJobNodeData(JobNodeStorage.java:72) at com.dangdang.ddframe.job.lite.internal.config.ConfigurationService.load(ConfigurationService.java:54) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.loadJobRootConfiguration(LiteJobFacade.java:78) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.loadJobRootConfiguration(LiteJobFacade.java:49) at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.(AbstractElasticJobExecutor.java:65) at com.dangdang.ddframe.job.executor.type.SimpleJobExecutor.(SimpleJobExecutor.java:35) at com.dangdang.ddframe.job.executor.JobExecutorFactory.getJobExecutor(JobExecutorFactory.java:51) at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ... 1 common frames omitted Caused by: java.lang.IllegalStateException: instance must be started before calling this method at com.google.common.base.Preconditions.checkState(Preconditions.java:173) at org.apache.curator.framework.imps.CuratorFrameworkImpl.getData(CuratorFrameworkImpl.java:375) at com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter.getDirectly(ZookeeperRegistryCenter.java:158) ... 11 common frames omitted 2019-08-14 14:02:00 【一DuizhangJob】任务开始执行===={"allowSendJobEvent":true,"currentJobEventSamplingCount":0,"jobEventSamplingCount":0,"jobName":"DuizhangJob","jobParameter":"test","shardingItemParameters":{},"shardingTotalCount":8,"taskId":"DuizhangJob@-@@-@READY@-@172.16.0.120@-@11893"}2019-08-14 14:02:00 【二-DuizhangJob】任务执行结束===={"allowSendJobEvent":true,"currentJobEventSamplingCount":0,"jobEventSamplingCount":0,"jobName":"DuizhangJob","jobParameter":"test","shardingItemParameters":{},"shardingTotalCount":8,"taskId":"DuizhangJob@-@@-@READY@-@172.16.0.120@-@11893"}

Please provide the reproduce example codes (such as github link),otherwise we will label the issue as Invalid and close it.(为了节省复现问题的时间,请务必提供可重现的代码,否则我们会将issue直接标记为invalid并关闭)

Code should based on https://github.com/elasticjob/elastic-job-example (代码请基于 https://github.com/elasticjob/elastic-job-example

purgeyao commented 5 years ago

这个问题排查到了吗? 据我所知 定时器内部失败后 就会这样,然后这个服务的其他定时器都会失效

wasd345 commented 5 years ago

这个问题排查到了吗? 据我所知 定时器内部失败后 就会这样,然后这个服务的其他定时器都会失效

已解决,配置文件开了8个实例也就是需要开8个tomcat(8片8个tomcat),实际测试环境中我只开了一个tomcat,线上所有的tomcat都开启,就不会报这个错了

purgeyao commented 5 years ago

哦 可以帮我看看https://github.com/elasticjob/elastic-job-lite/issues/672 这个问题和你一样吗

purgeyao commented 5 years ago

配置文件开了8个实例 这个配置文件只的是哪里的

wasd345 commented 5 years ago

配置文件开了8个实例 这个配置文件只的是哪里的

你的672估计也是这原因,其中有服务器挂掉了吧,我的springBoot架构项目,配置文件即application.yml文件中的这个参数shardingItemParameters,回答你这么多问题了,请给我发个红包吧,支付宝账号 813723897@qq.com

elasticJob: zk: serverLists: 172.16.0.22:2181 namespace: dingshitask DuizhangJob: cron: 0/30 ? overwrite: true shardingTotalCount: 8 shardingItemParameters: 0=0,1=1,2=2,3=3,4=4,5=5,6=6,7=7 jobParameter: test failover: true misfire: true description: 对账任务 monitorExecution: false disabled: true listener: com.expo.job.core.MessageElasticJobListener jobExceptionHandler: com.expo.job.core.CustomJobExceptionHandler