ruanwenjun commented on code in PR #17320:
URL: 
https://github.com/apache/dolphinscheduler/pull/17320#discussion_r2193935570


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ProcessUtils.java:
##########
@@ -144,18 +156,54 @@ public static boolean kill(@NonNull TaskExecutionContext 
request) {
      */
     private static boolean sendKillSignal(String signal, String pids, String 
tenantCode) {
         try {
+            // 1. Send the kill signal
             String killCmd = String.format("kill -s %s %s", signal, pids);
             killCmd = OSUtils.getSudoCmd(tenantCode, killCmd);
             log.info("Sending {} to process group: {}, command: {}", signal, 
pids, killCmd);
             OSUtils.exeCmd(killCmd);
 
+            // 2. Wait for the process to respond to the signal
+            ThreadUtils.sleep(SLEEP_TIME_MILLIS * PROCESS_STATUS_CHECK_DELAY);

Review Comment:
   Once send SIGINT/SIGTERM, the process might have some work to do, so the 
process will not exist directly, the process can ignore the sig, so we need to 
check during a window, if timeout and the process exist, then need to kill -9.



-- 
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