引出问题
现在是2022年9月19日14:38:19
定时任务上一次执行的时间是2022-09-14 15:03:12.620
将近5天的时间没执行。
造成的结果是,数据没入库。
上次重启是2个月之前。2022-7-21 上午9:52
肯定是有问题的。需要排查下原因。
解决步骤
使用的是quartz
看容器
docker ps 没看出来有啥问题
docker stats 也没看出来有啥问题
看日志
docker logs --tail -f 1000 容器Id
- 09-14 14:53:13.932 ERROR
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: java.lang.ArithmeticException: null - 09-14 14:54:52.671 ERROR 1 — [ryBean_Worker-9] org.quartz.core.JobRunShell : Job JOB_GROUP_NAME.memoryTask threw an unhandled Exception:
ElasticsearchStatusException status line [HTTP/1.1 429 Too Many Requests - 09-14 14:56:37.116 ERROR 1 — [ryBean_Worker-2] c.e.elasticsearch.ElasticsearchUtils : 添加文档失败
java.io.IOException: listener timeout after waiting for [30000] ms - 日志截止到14号15:03分
结论
某个/部分定时任务阻塞(http),占用了资源不释放,导致其他任务无法执行。
测试代码(复现代码)
git init
git commit -m “first commit”
git remote add origin https://gitee.com/ws66ds/norun.git
git push -u origin “master”
https://gitee.com/ws66ds/norun.git
相关参考文章
https://www.manongdao.com/article-2430767.html
https://blog.csdn.net/weixin_29306317/article/details/114392104