jokerhzf opened a new issue, #11903: URL: https://github.com/apache/dolphinscheduler/issues/11903
### 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 version:2.0.6 release ``` [INFO] 2022-09-09 10:00:51.577 org.apache.dolphinscheduler.server.worker.WorkerServer:[239] - ready to kill all cache job, job size:18 [INFO] 2022-09-09 10:00:51.610 org.apache.dolphinscheduler.plugin.task.api.ProcessUtils:[62] - process id:26156, cmd:sudo -u xxx kill -9 26156 26175 3 26181 3 26266 3 26267 3 26268 [ERROR] 2022-09-09 10:00:51.629 org.apache.dolphinscheduler.plugin.task.api.ProcessUtils:[66] - kill task failed org.apache.dolphinscheduler.plugin.task.api.AbstractShell$ExitCodeException: kill: sending signal to 3 failed: Operation not permitted kill: sending signal to 3 failed: Operation not permitted kill: sending signal to 26266 failed: No such process kill: sending signal to 3 failed: Operation not permitted kill: sending signal to 26267 failed: No such process kill: sending signal to 3 failed: Operation not permitted at org.apache.dolphinscheduler.plugin.task.api.AbstractShell.runCommand(AbstractShell.java:210) at org.apache.dolphinscheduler.plugin.task.api.AbstractShell.run(AbstractShell.java:124) at org.apache.dolphinscheduler.plugin.task.api.ShellExecutor.execute(ShellExecutor.java:130) at org.apache.dolphinscheduler.plugin.task.api.ShellExecutor.execCommand(ShellExecutor.java:105) at org.apache.dolphinscheduler.plugin.task.api.ShellExecutor.execCommand(ShellExecutor.java:87) at org.apache.dolphinscheduler.plugin.task.util.OSUtils.exeShell(OSUtils.java:95) at org.apache.dolphinscheduler.plugin.task.util.OSUtils.exeCmd(OSUtils.java:84) at org.apache.dolphinscheduler.plugin.task.api.ProcessUtils.kill(ProcessUtils.java:64) at org.apache.dolphinscheduler.server.worker.WorkerServer.killAllRunningTasks(WorkerServer.java:247) at org.apache.dolphinscheduler.server.worker.WorkerServer.close(WorkerServer.java:211) at org.apache.dolphinscheduler.server.worker.WorkerServer.stop(WorkerServer.java:231) at org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient.handleConnectionState(WorkerRegistryClient.java:158) at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:43) at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:280) at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:93) at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:90) at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89) at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:280) at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:44) at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:133) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) ``` ### What you expected to happen When the worker is killing the task, the process ID is incorrectly identified due to the regular expression. killAllRunningTasks() uses `org.apache.dolphinscheduler.plugin.task.api.ProcessUtils.kill(taskRequest)`, but this kill method uses `private static final Pattern WINDOWSATTERN = Pattern.compile("(\\d+)");` regular expressions to match.But this regular will also recognize python3 as a process ID. e.g. [xxx@ip-xx-xxx-xx-xx opt]$ pstree -p 19710 python3(19710)─┬─{python3}(19731) ├─{python3}(19732) └─{python3}(19733) **regex:**(\d+) **match result:** 3 19710 3 19731 3 19732 3 19733 ### How to reproduce Configure python3 shell script and trigger killAllRunningTasks() ### Anything else _No response_ ### Version 2.0.6 ### 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]
