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

单执行器,某任务单个执行成功,但定时执行必然失败 #3426

Open
HongyiPaulZeng opened this issue Apr 12, 2024 · 3 comments

Comments

@HongyiPaulZeng
Copy link

HongyiPaulZeng commented Apr 12, 2024

Please answer some questions before submitting your issue. Thanks!

Which version of XXL-JOB do you using?

2.4.0

Expected behavior

任务正常执行

Actual behavior

单个执行成功,但定时执行必然失败

Steps to reproduce the behavior

配置单个执行器,配置任务。

Other information

执行器日志:
2024-04-12 12:00:00 [com.xxl.job.core.thread.JobThread#run]-[133]-[xxl-job, JobThread-58-1712894400088]
----------- xxl-job job execute start -----------
----------- Param:null
2024-04-12 12:00:00 [com.xxl.job.core.handler.impl.ScriptJobHandler#execute]-[80]-[Thread-204] ----------- script file:./jobhandler/gluesource/58_1712825335000.sh -----------
2024-04-12 12:00:00 [com.xxl.job.core.util.ScriptUtil#execToFile]-[112]-[Thread-204] java.lang.NullPointerException
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1012)
at java.lang.Runtime.exec(Runtime.java:621)
at java.lang.Runtime.exec(Runtime.java:486)
at com.xxl.job.core.util.ScriptUtil.execToFile(ScriptUtil.java:76)
at com.xxl.job.core.handler.impl.ScriptJobHandler.execute(ScriptJobHandler.java:81)
at com.xxl.job.core.thread.JobThread$1.call(JobThread.java:146)
at com.xxl.job.core.thread.JobThread$1.call(JobThread.java:139)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)

2024-04-12 12:00:00 [com.xxl.job.core.thread.JobThread#run]-[179]-[xxl-job, JobThread-58-1712894400088]
----------- xxl-job job execute end(finish) -----------
----------- Result: handleCode=500, handleMsg = script exit value(-1) is failed
2024-04-12 12:00:00 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread]
----------- xxl-job job callback finish.

@HongyiPaulZeng HongyiPaulZeng changed the title 单执行器,同一时间多任务并发执行时会失败 单执行器,某任务单个执行成功,但定时执行必然失败 Apr 15, 2024
@HongyiPaulZeng
Copy link
Author

HongyiPaulZeng commented Apr 15, 2024

问题定位。定时触发任务,参数有时候会回以null传到执行器
2024-04-15 14:47:50 xxl-job-executor-sample-frameless [com.xxl.job.core.biz.impl.ExecutorBizImpl]-[xxl-job, EmbedServer bizThreadPool-357570359]-[run]-[48]-[INFO] TriggerParam{jobId=80, executorHandler='null', executorParams='null', executorBlockStrategy='SERIAL_EXECUTION', executorTimeout=60, logId=2179, logDateTime=1713163670013, glueType='GLUE_SHELL', glueSource='#!/usr/bin/env bash

这里executorParams 为 null
ScriptJobHandler中,会把NULL的参数加入到数组
}H{ZEUG)Q9GG)PB KCY`VTO

在ScriptUtil 中,没有正确过滤掉null参数。最终执行了一行null命令,导致空指针。

@syshenyao
Copy link

能否提供一个复现的demo,这里参数是执行器执行的时候入参

@HongyiPaulZeng
Copy link
Author

能否提供一个复现的demo,这里参数是执行器执行的时候入参

复现的demo我还真不知道怎么给你。我观察了日志,执行器收到的参数TriggerParam里,其中的executorParams有时候是null,有时候是空字符串。同样的任务,在手工执行和定时执行可能会是不同情况。但同样的shell脚本在不同的任务里不一定会复现。我自己在执行器加固了一下把这个BUG处理掉。admin那边我没继续追查了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants