Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

开启失效转移且分片任务执行后,任务会重复执行 by v2.1.0 #276

Closed
pioneersli opened this issue Apr 13, 2017 · 6 comments
Labels

Comments

@pioneersli
Copy link

pioneersli commented Apr 13, 2017

总共4个分片,但是每次0这个分片总是在4个分片执行完后,多了个线程把0这个分片又重新执行了一次 ,也就是每次一个轮训就要有一个分片被多执行一次,每次重复执行的那次的线程名称明显可以看出可其他的不太一致(当failover设置为true时存在此问题,failover为false是没有此问题)
下面是任务输出的信息:

[ob-myTestJob7-3] com.boot.job.MyJob : ==========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0,1,2,3@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=2, shardingParameter=C)
[ob-myTestJob7-2] com.boot.job.MyJob : ========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0,1,2,3@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=1, shardingParameter=B)
[ob-myTestJob7-4] com.boot.job.MyJob : ========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0,1,2,3@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=3, shardingParameter=D)
[ob-myTestJob7-1] com.boot.job.MyJob : =========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0,1,2,3@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=0, shardingParameter=A)
[stJob7_Worker-1] com.boot.job.MyJob : =========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=0, shardingParameter=A)
[ob-myTestJob7-5] com.boot.job.MyJob : ==========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0,1,2,3@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=0, shardingParameter=A)
[ob-myTestJob7-7] com.boot.job.MyJob : =========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0,1,2,3@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=2, shardingParameter=C)
[ob-myTestJob7-6] com.boot.job.MyJob : ==========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0,1,2,3@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=1, shardingParameter=B)
[ob-myTestJob7-8] com.boot.job.MyJob : ========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0,1,2,3@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=3, shardingParameter=D)
[stJob7_Worker-1] com.boot.job.MyJob : =========开始执行定时任务ShardingContext(jobName=myTestJob7, taskId=myTestJob7@-@0@-@ready@-@10.10.8.221@-@8eff493d-92e4-4415-a437-b4b38ceca74b, shardingTotalCount=4, jobParameter=ss, shardingItem=0, shardingParameter=A)

@terrymanu
Copy link
Member

请确认一下是不是作业服务器时钟不一致导致的

@pioneersli
Copy link
Author

时钟是一致的,刚才又让朋友试了下,也是同样的的问题,我是在springboot中使用的,而且把线程名称打印出来,明显感觉不太一样的

@terrymanu
Copy link
Member

请提供任务执行代码,配置以及运行环境说明

@terrymanu
Copy link
Member

光看描述感觉就像是正常的failover的功能,请确定一下分片0是否有执行失败的情况

@pioneersli
Copy link
Author

用提供的例子执行也是这个问题, 就是用的
elastic-job-example-lite-springboot这个例子,只不过把SimpleJobConfig中的getLiteJobConfiguration方法中将failover设置为true,然后去掉了和数据库的交互,直接让simplejob任务sleep(100),就出现了上述问题

@terrymanu
Copy link
Member

好的,我已经重现,感谢发现问题

terrymanu added a commit that referenced this issue Apr 14, 2017
@terrymanu terrymanu changed the title 2.1.0版本lite分片任务执行时,任务重复执行 开启失效转移且分片任务执行后,任务会重复执行 by v2.1.0 Apr 14, 2017
@terrymanu terrymanu added bug and removed disscussion labels Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants