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 2022/05/09 13:47:12 UTC
[GitHub] [shardingsphere-elasticjob] TeslaCN opened a new issue, #2074: Error may occur when shutting down instance contains OneOffJob with failover enabled
TeslaCN opened a new issue, #2074:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/2074
## Bug Report
### Which version of ElasticJob did you use?
ElasticJob master
127efa369858fe3de19ce3394f85d141dda74810
### Which project did you use? ElasticJob-Lite or ElasticJob-Cloud?
Lite
### Expected behavior
### Actual behavior
```
2022-05-07 22:00:02.500 ERROR 45526 --- [NotifyService-0] o.a.c.f.listen.MappingListenerManager : Listener (org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter$$Lambda$1023/0x000000080116cf98@198ca061) threw an exception
org.apache.shardingsphere.elasticjob.reg.exception.RegException: org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException: org.quartz.JobPersistenceException: The job (DEFAULT.log-simple-job) referenced by the trigger does not exist.
at org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter.handleException(ZookeeperRegistryCenter.java:444) ~[elasticjob-registry-center-zookeeper-curator-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
at org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter.executeInLeader(ZookeeperRegistryCenter.java:406) ~[elasticjob-registry-center-zookeeper-curator-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
at org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage.executeInLeader(JobNodeStorage.java:203) ~[elasticjob-lite-core-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
at org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverService.failoverIfNecessary(FailoverService.java:81) ~[elasticjob-lite-core-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
at org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverListenerManager$JobCrashedJobListener.onChange(FailoverListenerManager.java:90) ~[elasticjob-lite-core-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
at org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter.lambda$watch$3(ZookeeperRegistryCenter.java:423) ~[elasticjob-registry-center-zookeeper-curator-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
at org.apache.curator.framework.recipes.cache.CuratorCacheImpl.lambda$null$8(CuratorCacheImpl.java:286) ~[curator-recipes-5.1.0.jar:5.1.0]
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92) ~[curator-framework-5.1.0.jar:5.1.0]
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89) ~[curator-framework-5.1.0.jar:5.1.0]
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89) ~[curator-framework-5.1.0.jar:5.1.0]
at org.apache.curator.framework.recipes.cache.CuratorCacheImpl.lambda$callListeners$10(CuratorCacheImpl.java:293) ~[curator-recipes-5.1.0.jar:5.1.0]
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException: org.quartz.JobPersistenceException: The job (DEFAULT.log-simple-job) referenced by the trigger does not exist.
at org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController.triggerJob(JobScheduleController.java:173) ~[elasticjob-lite-core-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
at org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverService$FailoverLeaderExecutionCallback.execute(FailoverService.java:194) ~[elasticjob-lite-core-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
at org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter.executeInLeader(ZookeeperRegistryCenter.java:402) ~[elasticjob-registry-center-zookeeper-curator-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
... 13 common frames omitted
Caused by: org.quartz.JobPersistenceException: The job (DEFAULT.log-simple-job) referenced by the trigger does not exist.
at org.quartz.simpl.RAMJobStore.storeTrigger(RAMJobStore.java:422) ~[quartz-2.3.2.jar:na]
at org.quartz.core.QuartzScheduler.triggerJob(QuartzScheduler.java:1162) ~[quartz-2.3.2.jar:na]
at org.quartz.impl.StdScheduler.triggerJob(StdScheduler.java:341) ~[quartz-2.3.2.jar:na]
at org.quartz.impl.StdScheduler.triggerJob(StdScheduler.java:331) ~[quartz-2.3.2.jar:na]
at org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController.triggerJob(JobScheduleController.java:167) ~[elasticjob-lite-core-3.1.0-SNAPSHOT.jar:3.1.0-SNAPSHOT]
... 15 common frames omitted
```
dump
```
└─[$]> echo 'dump@log-simple-job' | nc 127.0.0.1 65530
/log-simple-job/trigger |
/log-simple-job/sharding |
/log-simple-job/sharding/8 |
/log-simple-job/sharding/8/instance | ip1@-@1
/log-simple-job/sharding/7 |
/log-simple-job/sharding/7/instance | ip2@-@1
/log-simple-job/sharding/7/failovering | ip3@-@45526
/log-simple-job/sharding/7/failover | ip3@-@45526
/log-simple-job/sharding/6 |
/log-simple-job/sharding/6/instance | ip3@-@45526
/log-simple-job/sharding/5 |
/log-simple-job/sharding/5/instance | ip4@-@1
/log-simple-job/sharding/4 |
/log-simple-job/sharding/4/instance | ip5@-@1
/log-simple-job/sharding/3 |
/log-simple-job/sharding/3/instance | ip6@-@1
/log-simple-job/sharding/2 |
/log-simple-job/sharding/2/instance | ip1@-@1
/log-simple-job/sharding/1 |
/log-simple-job/sharding/1/instance | ip2@-@1
/log-simple-job/sharding/0 |
/log-simple-job/sharding/0/instance | ip3@-@45526
/log-simple-job/servers |
/log-simple-job/servers/ip3 | ENABLED
/log-simple-job/servers/ip2 | ENABLED
/log-simple-job/servers/ip1 | ENABLED
/log-simple-job/servers/ip6 | ENABLED
/log-simple-job/servers/ip5 | ENABLED
/log-simple-job/servers/ip4 | ENABLED
/log-simple-job/leader |
/log-simple-job/leader/sharding |
/log-simple-job/leader/sharding/necessary |
/log-simple-job/leader/failover |
/log-simple-job/leader/failover/items |
/log-simple-job/leader/election |
/log-simple-job/leader/election/instance | ip4@-@1
/log-simple-job/instances |
/log-simple-job/instances/ip3@-@45526 | jobInstanceId: ip3@-@45526
serverIp: ip3
/log-simple-job/instances/ip4@-@1 | jobInstanceId: ip4@-@1
serverIp: ip4
/log-simple-job/config | description: ''
disabled: false
failover: true
jobName: log-simple-job
jobParameter: ''
maxTimeDiffSeconds: -1
misfire: false
monitorExecution: false
overwrite: true
reconcileIntervalMinutes: 0
shardingItemParameters: ''
shardingTotalCount: 9
staticSharding: false
```
### Reason analyze (If you can)
### Steps to reproduce the behavior.
### Example codes for reproduce this issue (such as a github link).
```yaml
spring:
datasource:
url: jdbc:postgresql://127.0.0.1:5432/elasticjob
username: postgres
password: postgres
elasticjob:
dump:
port: 65530
reg-center:
server-lists: 127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
namespace: spring
session-timeout-milliseconds: 5000
jobs:
log-simple-job:
elastic-job-class: icu.wwj.hello.spring.elasticjob.job.LogSimpleJob
job-bootstrap-bean-name: logSimpleJobBootstrap
sharding-total-count: 9
failover: true
overwrite: true
```
```java
package icu.wwj.hello.spring.elasticjob.job;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class LogSimpleJob implements SimpleJob {
@Override
public void execute(final ShardingContext shardingContext) {
log.info("{}", shardingContext);
}
}
```
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Error may occur when shutting down instance contains OneOffJob with failover enabled [shardingsphere-elasticjob]
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on issue #2074:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/2074#issuecomment-4708384703
I was actually unable to reproduce this bug using the master branch.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] CherishCai commented on issue #2074: Error may occur when shutting down instance contains OneOffJob with failover enabled
Posted by GitBox <gi...@apache.org>.
CherishCai commented on issue #2074:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/2074#issuecomment-1220540811
Maybe add a ShutdownHook on spring Environment, should in ScheduleJobBootstrapStartupRunner?
```java
Runtime.getRuntime().addShutdownHook(()->{
applicationContext.getBeansOfType(JobBootstrap).values().forEach(JobBootstrap::shutdown);
});
```
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org