cadl opened a new issue, #11704:
URL: https://github.com/apache/dolphinscheduler/issues/11704

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   When my shell task got a timeout, the workflow instance status will fail, 
but the shell process is still running.
   
   
   https://github.com/apache/dolphinscheduler/pull/5212 fixed 
TaskKillProcessor. But the shell task timeout operation still issues kill 
action to parent pid directly.  
   
   Maybe https://github.com/apache/dolphinscheduler/issues/11051 meet same 
issue.
   
   worker log:
   ```
   TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[290] - task run 
command: sudo -u xcfapp sh 
/jfs/dolphinscheduler/exec/process/6035996488480/6708908920992_2/344166/399310/344166_399310.command
   [INFO] 2022-08-30 17:01:01.281 
[taskAppId=TASK-20220830-6708908920992_2-344166-399310] TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[181] - process start, 
process id is: 27646
   [ERROR] 2022-08-30 17:31:01.281 
[taskAppId=TASK-20220830-6708908920992_2-344166-399310] TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[103] - shell task error
   java.lang.IllegalThreadStateException: process hasn't exited
        at java.base/java.lang.ProcessImpl.exitValue(ProcessImpl.java:521)
        at 
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor.run(AbstractCommandExecutor.java:200)
        at 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask.handle(ShellTask.java:97)
        at 
org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:182)
        at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
   [INFO] 2022-08-30 17:31:01.281 
[taskAppId=TASK-20220830-6708908920992_2-344166-399310] TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[57] - FINALIZE_SESSION
   [INFO] 2022-08-30 17:31:01.281 
[taskAppId=TASK-20220830-6708908920992_2-344166-399310] TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[230] - cancel process: 
27646
   [INFO] 2022-08-30 17:31:01.282 
[taskAppId=TASK-20220830-6708908920992_2-344166-399310] TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[259] - soft kill 
task:344166_399310, process id:27646, cmd:sudo -u xcfapp kill 27646
   [INFO] 2022-08-30 18:08:31.636 
[taskAppId=TASK-20220830-6708908920992_2-344166-399310] TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[57] - FINALIZE_SESSION
   ```
   
   ### What you expected to happen
   
   Shell task can kill process success
   
   ### How to reproduce
   
   - prepare a tenant named `foo`
   - create a workflow and shell task, set shell command as `sleep 300`, and 
set timeout to 1 minute
   - schedule the workflow
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   3.0.0
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to