You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "asadjan4611 (via GitHub)" <gi...@apache.org> on 2026/03/11 09:45:38 UTC

[PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

asadjan4611 opened a new pull request, #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050

   ## Purpose of the pull request
   
   Close: #18034
   
   The Script Alert Plugin executes external scripts to send alerts. Currently, ProcessUtils.executeScript() calls process.waitFor() with no timeout. If a script hangs (network stall, deadlock, etc.), it permanently blocks a thread in the alert sender thread pool, degrading or blocking all alert delivery.
   
   This PR adds a configurable timeout parameter (default: 60 seconds) to the Script Alert Plugin following the same pattern used by the HTTP Alert Plugin.
   
   ## Brief change log
   
   - Add SCRIPT_TIMEOUT, NAME_SCRIPT_TIMEOUT, DEFAULT_SCRIPT_TIMEOUT constants to ScriptParamsConstants
   - Add InputNumberParam timeout parameter to ScriptAlertChannelFactory.params()
   - Replace blocking process.waitFor() with process.waitFor(timeout, TimeUnit.SECONDS) in ProcessUtils
   - Destroy process forcibly and interrupt stream gobblers on timeout
   - Parse timeout config in ScriptSender with fallback to default
   - Handle timeout exit code with clear error message in alert result
   
   ## Verify this pull request
   
   This change added tests and can be verified as follows:
   
   - Added ProcessUtilsTest.testExecuteScriptTimeout to verify process timeout and forced destruction (returns exit code -2)
   - Added ScriptSenderTest.testDefaultTimeout to verify default timeout works correctly
   - Added ScriptSenderTest.testCustomTimeout to verify custom timeout value is parsed and applied
   - Updated ScriptAlertChannelFactoryTest.testGetParams to verify new param count (3 → 4)
   - Compilation verified locally with `mvn clean compile`


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4207468787

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=18050&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2994660601


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java:
##########
@@ -18,25 +18,30 @@
 package org.apache.dolphinscheduler.plugin.alert.script;
 
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public final class ProcessUtils {
 
+    static final int EXECUTE_ERROR_EXIT_CODE = -1;

Review Comment:
   okay fixed out
   



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java:
##########
@@ -17,23 +17,52 @@
 
 package org.apache.dolphinscheduler.plugin.alert.script;
 
+import java.io.File;
+
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 /**
  * ProcessUtilsTest
  */
 public class ProcessUtilsTest {
 
-    private static final String rootPath = System.getProperty("user.dir");
+    @Test
+    public void testExecuteScript() {
+        String javaBin = getJavaBin();
+        String[] cmd = {javaBin, "-cp", System.getProperty("java.class.path"),
+                ProcessUtilsTest.class.getName() + "$SimpleMain"};
+        int code = ProcessUtils.executeScript(60, cmd);
+        Assertions.assertNotEquals(ProcessUtils.EXECUTE_ERROR_EXIT_CODE, code);
+    }
 
-    private static final String shellFilPath =
-            rootPath + "/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/test.sh";
+    @Test
+    public void testExecuteScriptTimeout() {
+        String javaBin = getJavaBin();
+        String[] sleepCmd = {javaBin, "-cp", System.getProperty("java.class.path"),
+                ProcessUtilsTest.class.getName() + "$SleepMain"};
+        int code = ProcessUtils.executeScript(2, sleepCmd);
+        Assertions.assertEquals(ProcessUtils.EXECUTE_TIMEOUT_EXIT_CODE, code);
+    }
 
-    private String[] cmd = {"/bin/sh", "-c", shellFilPath + " -t 1"};
+    private static String getJavaBin() {

Review Comment:
   fixed



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939150448


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java:
##########
@@ -47,6 +48,19 @@ public final class ScriptSender {
         userParams = StringUtils.isNotBlank(config.get(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS))
                 ? config.get(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS)
                 : "";
+        String timeoutConfig = config.get(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT);
+        if (StringUtils.isNotBlank(timeoutConfig)) {

Review Comment:
   ```suggestion
           if (StringUtils.isNotEmpty(timeoutConfig)) {
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java:
##########
@@ -46,12 +48,53 @@ static Integer executeScript(String... cmd) {
 
             inputStreamGobbler.start();
             errorStreamGobbler.start();
-            return process.waitFor();
-        } catch (IOException | InterruptedException e) {
-            log.error("execute alert script error {}", e.getMessage());
+
+            if (timeoutSeconds > 0) {
+                boolean finished = process.waitFor(timeoutSeconds, TimeUnit.SECONDS);
+                if (!finished) {
+                    log.error("script execution timed out after {} seconds, destroying process", timeoutSeconds);
+                    process.destroyForcibly();
+                    closeProcessStreams(process);
+                    joinGobbler(inputStreamGobbler);
+                    joinGobbler(errorStreamGobbler);
+                    return -2;

Review Comment:
   It's better to use positive integer here.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java:
##########
@@ -66,7 +68,18 @@ public List<PluginParams> params() {
                 .addValidate(Validate.newBuilder().setRequired(true).build())
                 .build();
 
-        return Arrays.asList(scriptUserParam, scriptPathParam, scriptTypeParams);
+        InputNumberParam scriptTimeoutParam =

Review Comment:
   It is best to tell the user the meaning of the exit code in the document.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java:
##########
@@ -32,8 +35,17 @@ public class ProcessUtilsTest {
     private String[] cmd = {"/bin/sh", "-c", shellFilPath + " -t 1"};
 
     @Test
+    @DisabledOnOs(OS.WINDOWS)

Review Comment:
   We don't need to do this since we've decleared in the document that windows is not supported.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java:
##########
@@ -47,6 +48,19 @@ public final class ScriptSender {
         userParams = StringUtils.isNotBlank(config.get(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS))
                 ? config.get(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS)
                 : "";
+        String timeoutConfig = config.get(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT);
+        if (StringUtils.isNotBlank(timeoutConfig)) {
+            long parsedTimeout = ScriptParamsConstants.DEFAULT_SCRIPT_TIMEOUT;
+            try {
+                parsedTimeout = Long.parseLong(timeoutConfig);
+            } catch (NumberFormatException ex) {
+                log.warn("Invalid script timeout config value: '{}', using default: {}",

Review Comment:
   We should return `alertResult` here.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java:
##########
@@ -32,8 +35,17 @@ public class ProcessUtilsTest {
     private String[] cmd = {"/bin/sh", "-c", shellFilPath + " -t 1"};
 
     @Test
+    @DisabledOnOs(OS.WINDOWS)
     public void testExecuteScript() {
-        int code = ProcessUtils.executeScript(cmd);
-        assert code != -1;
+        int code = ProcessUtils.executeScript(60, cmd);
+        Assertions.assertNotEquals(-1, code);
+    }
+
+    @Test
+    @DisabledOnOs(OS.WINDOWS)

Review Comment:
   Same here.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4285571705

   > There are still many unaddressed comments, you should check them yourself first.
   
   This is still unaddressed. @asadjan4611 


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4159479597

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=18050&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4039558889

   @SbloodyS I have resolved all the copilot issue's please review it again.
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4204746416

   CI still failed. @asadjan4611 


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2994662681


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -35,17 +37,18 @@ public class ScriptSenderTest {
 
     private static final String rootPath = System.getProperty("user.dir");
     private static final String shellFilPath = rootPath + "/src/test/script/shell/scriptExample.sh";
-    private static Map<String, String> scriptConfig = new HashMap<>();
+    private Map<String, String> scriptConfig;
 
     @BeforeEach
     public void initScriptConfig() {
-
+        scriptConfig = new HashMap<>();
         scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TYPE, String.valueOf(ScriptType.SHELL.getDescp()));
         scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS, "userParams");
         scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_PATH, shellFilPath);
     }
 
     @Test
+    @DisabledOnOs(OS.WINDOWS)

Review Comment:
   fixed



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4066508668

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [4 New issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=18050&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=18050&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=18050&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [76.1% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=18050&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=18050&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4206054273

   @SbloodyS 
   i have fix all the checks that have been failing and i test it locally now all the checks related to it have been passsed


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4251665986

   @SbloodyS i  have fixed all the issue can you please take a look into it .Thanks you .
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4656837140

   This function is not universal, users can set the timeout in the script by themselves, and I will close this PR. Thanks for your contribution.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2917289741


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java:
##########
@@ -46,7 +48,16 @@ static Integer executeScript(String... cmd) {
 
             inputStreamGobbler.start();
             errorStreamGobbler.start();
-            return process.waitFor();
+
+            boolean finished = process.waitFor(timeoutSeconds, TimeUnit.SECONDS);
+            if (!finished) {
+                log.error("script execution timed out after {} seconds, destroying process", timeoutSeconds);
+                process.destroyForcibly();
+                inputStreamGobbler.interrupt();
+                errorStreamGobbler.interrupt();
+                return -2;

Review Comment:
   `timeoutSeconds` is documented as "if <= 0 waits indefinitely", but the implementation always calls `process.waitFor(timeoutSeconds, TimeUnit.SECONDS)`. For `timeoutSeconds <= 0` this will not wait indefinitely and can immediately return `-2`. Handle `timeoutSeconds <= 0` by calling `process.waitFor()` (no timeout) and only using timed wait when `timeoutSeconds > 0`.
   ```suggestion
               if (timeoutSeconds > 0) {
                   boolean finished = process.waitFor(timeoutSeconds, TimeUnit.SECONDS);
                   if (!finished) {
                       log.error("script execution timed out after {} seconds, destroying process", timeoutSeconds);
                       process.destroyForcibly();
                       inputStreamGobbler.interrupt();
                       errorStreamGobbler.interrupt();
                       return -2;
                   }
               } else {
                   // Wait indefinitely when timeoutSeconds <= 0, as documented
                   process.waitFor();
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java:
##########
@@ -46,7 +48,16 @@ static Integer executeScript(String... cmd) {
 
             inputStreamGobbler.start();
             errorStreamGobbler.start();
-            return process.waitFor();
+
+            boolean finished = process.waitFor(timeoutSeconds, TimeUnit.SECONDS);
+            if (!finished) {
+                log.error("script execution timed out after {} seconds, destroying process", timeoutSeconds);
+                process.destroyForcibly();
+                inputStreamGobbler.interrupt();
+                errorStreamGobbler.interrupt();
+                return -2;
+            }
+            return process.exitValue();

Review Comment:
   On timeout the code interrupts the `StreamGobbler` threads, but `StreamGobbler` blocks on `BufferedReader.readLine()` and doesn’t check the interrupt flag, so `interrupt()` alone may not stop these threads promptly. Consider closing the process streams and/or updating the gobblers to exit on interrupt, and then `join()` them (or mark them as daemon) to avoid leaking threads after a timeout.
   ```suggestion
                   try {
                       process.getInputStream().close();
                   } catch (IOException ioe) {
                       log.warn("Failed to close process input stream after timeout", ioe);
                   }
                   try {
                       process.getErrorStream().close();
                   } catch (IOException ioe) {
                       log.warn("Failed to close process error stream after timeout", ioe);
                   }
                   inputStreamGobbler.interrupt();
                   errorStreamGobbler.interrupt();
                   try {
                       inputStreamGobbler.join(TimeUnit.SECONDS.toMillis(1));
                   } catch (InterruptedException ie) {
                       Thread.currentThread().interrupt();
                   }
                   try {
                       errorStreamGobbler.join(TimeUnit.SECONDS.toMillis(1));
                   } catch (InterruptedException ie) {
                       Thread.currentThread().interrupt();
                   }
                   return -2;
               }
               int processExitCode = process.exitValue();
               try {
                   inputStreamGobbler.join(TimeUnit.SECONDS.toMillis(1));
               } catch (InterruptedException ie) {
                   Thread.currentThread().interrupt();
               }
               try {
                   errorStreamGobbler.join(TimeUnit.SECONDS.toMillis(1));
               } catch (InterruptedException ie) {
                   Thread.currentThread().interrupt();
               }
               return processExitCode;
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -100,4 +100,19 @@ public void testTypeIsError() {
         assertFalse(alertResult.isSuccess());
     }
 
+    @Test
+    public void testDefaultTimeout() {
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        Assertions.assertTrue(alertResult.isSuccess());
+    }
+
+    @Test
+    public void testCustomTimeout() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "30");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        Assertions.assertTrue(alertResult.isSuccess());
+    }

Review Comment:
   `scriptConfig` is a static mutable map and `@BeforeEach` does not clear it. After `testCustomTimeout` sets `NAME_SCRIPT_TIMEOUT`, later tests may unintentionally reuse that value (test order is not guaranteed), making tests flaky. Clear/recreate the map in `@BeforeEach` or remove the timeout key at the end of this test.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java:
##########
@@ -47,6 +48,9 @@ public final class ScriptSender {
         userParams = StringUtils.isNotBlank(config.get(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS))
                 ? config.get(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS)
                 : "";
+        timeout = StringUtils.isNotBlank(config.get(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT))
+                ? Long.parseLong(config.get(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT))
+                : ScriptParamsConstants.DEFAULT_SCRIPT_TIMEOUT;

Review Comment:
   `Long.parseLong(config.get(NAME_SCRIPT_TIMEOUT))` can throw `NumberFormatException` if the stored plugin config contains a non-numeric value. To prevent alert sending from failing with an uncaught exception, parse this defensively (e.g., try/catch with fallback to `DEFAULT_SCRIPT_TIMEOUT`, optionally logging a warning).
   ```suggestion
           String timeoutConfig = config.get(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT);
           if (StringUtils.isNotBlank(timeoutConfig)) {
               long parsedTimeout = ScriptParamsConstants.DEFAULT_SCRIPT_TIMEOUT;
               try {
                   parsedTimeout = Long.parseLong(timeoutConfig);
               } catch (NumberFormatException ex) {
                   log.warn("Invalid script timeout config value: '{}', using default: {}",
                           timeoutConfig, ScriptParamsConstants.DEFAULT_SCRIPT_TIMEOUT, ex);
               }
               timeout = parsedTimeout;
           } else {
               timeout = ScriptParamsConstants.DEFAULT_SCRIPT_TIMEOUT;
           }
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -100,4 +100,19 @@ public void testTypeIsError() {
         assertFalse(alertResult.isSuccess());
     }
 
+    @Test
+    public void testDefaultTimeout() {
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        Assertions.assertTrue(alertResult.isSuccess());
+    }
+
+    @Test
+    public void testCustomTimeout() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "30");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        Assertions.assertTrue(alertResult.isSuccess());
+    }

Review Comment:
   `testDefaultTimeout`/`testCustomTimeout` currently only assert that sending succeeds, but they don’t validate that the configured timeout value is actually parsed/applied. To meaningfully test the new behavior, consider using a script/command that sleeps longer than the configured timeout and assert a timeout failure, or mock/spying `ProcessUtils` to assert it’s called with the expected timeout.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java:
##########
@@ -33,7 +36,15 @@ public class ProcessUtilsTest {
 
     @Test
     public void testExecuteScript() {
-        int code = ProcessUtils.executeScript(cmd);
+        int code = ProcessUtils.executeScript(60, cmd);
         assert code != -1;

Review Comment:
   This test uses the Java `assert` keyword, which is disabled by default in Maven/JUnit runs unless `-ea` is set, so the assertion may never execute. Use JUnit assertions (e.g., `Assertions.assertNotEquals(-1, code)` or a more specific expected exit code) so the test reliably validates behavior.
   ```suggestion
           Assertions.assertNotEquals(-1, code);
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java:
##########
@@ -66,7 +68,17 @@ public List<PluginParams> params() {
                 .addValidate(Validate.newBuilder().setRequired(true).build())
                 .build();
 
-        return Arrays.asList(scriptUserParam, scriptPathParam, scriptTypeParams);
+        InputNumberParam scriptTimeoutParam =
+                InputNumberParam.newBuilder(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT,
+                        ScriptParamsConstants.SCRIPT_TIMEOUT)
+                        .setValue(ScriptParamsConstants.DEFAULT_SCRIPT_TIMEOUT)
+                        .addValidate(Validate.newBuilder()
+                                .setType(DataType.NUMBER.getDataType())
+                                .setRequired(false)

Review Comment:
   The new timeout parameter allows any number, including negative values, which can lead to unexpected behavior in `ProcessUtils` (and may cause immediate timeout). Add a `min` validation (e.g., `setMin(0D)` or `setMin(1D)` depending on whether 0 should disable timeouts) to constrain input in the UI/config.
   ```suggestion
                                   .setRequired(false)
                                   .setMin(0D)
   ```



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r3245889937


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/pom.xml:
##########
@@ -48,6 +48,24 @@
             <artifactId>dolphinscheduler-common</artifactId>
             <scope>provided</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+            <scope>provided</scope>
+        </dependency>

Review Comment:
   okay @SbloodyS  it has been fixed 



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2993020658


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java:
##########
@@ -18,25 +18,30 @@
 package org.apache.dolphinscheduler.plugin.alert.script;
 
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public final class ProcessUtils {
 
+    static final int EXECUTE_ERROR_EXIT_CODE = -1;

Review Comment:
   Do not use negative number here.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java:
##########
@@ -17,23 +17,52 @@
 
 package org.apache.dolphinscheduler.plugin.alert.script;
 
+import java.io.File;
+
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 /**
  * ProcessUtilsTest
  */
 public class ProcessUtilsTest {
 
-    private static final String rootPath = System.getProperty("user.dir");
+    @Test
+    public void testExecuteScript() {
+        String javaBin = getJavaBin();
+        String[] cmd = {javaBin, "-cp", System.getProperty("java.class.path"),
+                ProcessUtilsTest.class.getName() + "$SimpleMain"};
+        int code = ProcessUtils.executeScript(60, cmd);
+        Assertions.assertNotEquals(ProcessUtils.EXECUTE_ERROR_EXIT_CODE, code);
+    }
 
-    private static final String shellFilPath =
-            rootPath + "/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/test.sh";
+    @Test
+    public void testExecuteScriptTimeout() {
+        String javaBin = getJavaBin();
+        String[] sleepCmd = {javaBin, "-cp", System.getProperty("java.class.path"),
+                ProcessUtilsTest.class.getName() + "$SleepMain"};
+        int code = ProcessUtils.executeScript(2, sleepCmd);
+        Assertions.assertEquals(ProcessUtils.EXECUTE_TIMEOUT_EXIT_CODE, code);
+    }
 
-    private String[] cmd = {"/bin/sh", "-c", shellFilPath + " -t 1"};
+    private static String getJavaBin() {

Review Comment:
   Same as https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -35,17 +37,18 @@ public class ScriptSenderTest {
 
     private static final String rootPath = System.getProperty("user.dir");
     private static final String shellFilPath = rootPath + "/src/test/script/shell/scriptExample.sh";
-    private static Map<String, String> scriptConfig = new HashMap<>();
+    private Map<String, String> scriptConfig;
 
     @BeforeEach
     public void initScriptConfig() {
-
+        scriptConfig = new HashMap<>();
         scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TYPE, String.valueOf(ScriptType.SHELL.getDescp()));
         scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS, "userParams");
         scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_PATH, shellFilPath);
     }
 
     @Test
+    @DisabledOnOs(OS.WINDOWS)

Review Comment:
   Same as https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r3013125822


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java:
##########
@@ -46,12 +51,53 @@ static Integer executeScript(String... cmd) {
 
             inputStreamGobbler.start();
             errorStreamGobbler.start();
-            return process.waitFor();
-        } catch (IOException | InterruptedException e) {
-            log.error("execute alert script error {}", e.getMessage());
+
+            if (timeoutSeconds > 0) {
+                boolean finished = process.waitFor(timeoutSeconds, TimeUnit.SECONDS);
+                if (!finished) {
+                    log.error("script execution timed out after {} seconds, destroying process", timeoutSeconds);
+                    process.destroyForcibly();
+                    closeProcessStreams(process);
+                    joinGobbler(inputStreamGobbler);
+                    joinGobbler(errorStreamGobbler);
+                    return EXECUTE_TIMEOUT_EXIT_CODE;
+                }
+            } else {
+                process.waitFor();
+            }
+            int processExitCode = process.exitValue();
+            joinGobbler(inputStreamGobbler);
+            joinGobbler(errorStreamGobbler);
+            return processExitCode;
+        } catch (InterruptedException e) {
+            log.error("execute alert script interrupted {}", e.getMessage());
             Thread.currentThread().interrupt();
+        } catch (IOException e) {
+            log.error("execute alert script error {}", e.getMessage());
         }
 
         return exitCode;
     }
+
+    private static void closeProcessStreams(Process process) {
+        try {
+            process.getInputStream().close();
+        } catch (IOException e) {
+            log.warn("Failed to close process input stream after timeout", e);
+        }
+        try {
+            process.getErrorStream().close();
+        } catch (IOException e) {
+            log.warn("Failed to close process error stream after timeout", e);
+        }
+    }
+
+    private static void joinGobbler(StreamGobbler gobbler) {
+        try {
+            gobbler.interrupt();
+            gobbler.join(TimeUnit.SECONDS.toMillis(1));
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();

Review Comment:
   `joinGobbler()` interrupts the `StreamGobbler` thread and only waits 1 second. However `StreamGobbler.run()` blocks on `BufferedReader.readLine()` and does not check interruption, so the interrupt is ineffective and this method can return while gobbler threads are still running. That can lead to thread accumulation under heavy alert load (or very large outputs). Consider making `StreamGobbler` interruption-aware (break loop on interrupt / handle IOException from closed stream), setting gobbler threads as daemon, and/or joining without a fixed 1s timeout after the process has exited and streams are closed.
   ```suggestion
               gobbler.join();
           } catch (InterruptedException e) {
               Thread.currentThread().interrupt();
               log.warn("Interrupted while waiting for stream gobbler to finish", e);
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java:
##########
@@ -66,7 +68,18 @@ public List<PluginParams> params() {
                 .addValidate(Validate.newBuilder().setRequired(true).build())
                 .build();
 
-        return Arrays.asList(scriptUserParam, scriptPathParam, scriptTypeParams);
+        InputNumberParam scriptTimeoutParam =
+                InputNumberParam.newBuilder(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT,
+                        ScriptParamsConstants.SCRIPT_TIMEOUT)
+                        .setValue(ScriptParamsConstants.DEFAULT_SCRIPT_TIMEOUT)
+                        .addValidate(Validate.newBuilder()
+                                .setType(DataType.NUMBER.getDataType())
+                                .setRequired(false)
+                                .setMin(0D)

Review Comment:
   `executeScript()` treats `timeoutSeconds <= 0` as “wait indefinitely” (see Javadoc), but the new UI param validation allows `0` (`setMin(0D)`), and `ScriptSender.parseTimeout()` doesn’t reject `0`/negative values. This means a misconfiguration can disable the timeout entirely and reintroduce the original “hang forever” problem. If disabling timeouts isn’t an intended feature, enforce `timeout >= 1` (UI + backend) or fall back to the default when `timeout <= 0`; if it is intended, please document that `0` disables the timeout.
   ```suggestion
                                   .setMin(1D)
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -100,4 +114,46 @@ public void testTypeIsError() {
         assertFalse(alertResult.isSuccess());
     }
 
+    @Test
+    public void testDefaultTimeout() {
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+
+    @Test
+    public void testCustomTimeout() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "30");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+

Review Comment:
   `testDefaultTimeout()` and `testCustomTimeout()` are effectively duplicates of the existing happy-path test and don’t assert that the configured timeout is actually parsed and applied (e.g., by executing a script that sleeps longer than the configured timeout and asserting a timeout result). As written, these tests would still pass even if the timeout value were ignored.
   ```suggestion
   
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -100,4 +114,46 @@ public void testTypeIsError() {
         assertFalse(alertResult.isSuccess());
     }
 
+    @Test
+    public void testDefaultTimeout() {
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+
+    @Test
+    public void testCustomTimeout() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "30");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+
+    @Test
+    public void testInvalidTimeoutFallsBackToDefault() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "notANumber");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        Assertions.assertFalse(alertResult.isSuccess());
+        if (isWindows()) {
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertEquals("script timeout config is invalid, should be a number", alertResult.getMessage());
+        }
+    }

Review Comment:
   The test name `testInvalidTimeoutFallsBackToDefault` suggests that an invalid timeout should fall back to the default, but the assertions expect the send to fail with an “invalid config” message (on non-Windows). Either rename this test to reflect the current behavior, or adjust the implementation to actually fall back to the default timeout as the name implies.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java:
##########
@@ -106,18 +108,42 @@ private AlertResult executeShellScript(String title, String content) {
             return alertResult;
         }
 
+        Long timeout = parseTimeout(alertResult);
+        if (timeout == null) {
+            return alertResult;
+        }
+
         String[] cmd = {"/bin/sh", "-c", scriptPath + ALERT_TITLE_OPTION + "'" + title + "'" + ALERT_CONTENT_OPTION
                 + "'" + content + "'" + ALERT_USER_PARAMS_OPTION + "'" + userParams + "'"};
-        int exitCode = ProcessUtils.executeScript(cmd);
+        int exitCode = ProcessUtils.executeScript(timeout, cmd);
 
         if (exitCode == 0) {
             alertResult.setSuccess(true);
             alertResult.setMessage("send script alert msg success");
             return alertResult;
         }
+        if (exitCode == ProcessUtils.EXECUTE_TIMEOUT_EXIT_CODE) {
+            alertResult.setMessage("send script alert msg error, script execution timed out after " + timeout
+                    + " seconds");
+            log.error("send script alert msg error, script execution timed out after {} seconds", timeout);
+            return alertResult;
+        }
         alertResult.setMessage("send script alert msg error,exitCode is " + exitCode);
         log.info("send script alert msg error,exitCode is {}", exitCode);
         return alertResult;
     }
 
+    private Long parseTimeout(AlertResult alertResult) {
+        if (StringUtils.isNotEmpty(timeoutConfig)) {
+            try {
+                return Long.parseLong(timeoutConfig);
+            } catch (NumberFormatException ex) {
+                log.warn("Invalid script timeout config value: '{}'", timeoutConfig, ex);
+                alertResult.setMessage("script timeout config is invalid, should be a number");
+                return null;
+            }
+        }
+        return (long) ScriptParamsConstants.DEFAULT_SCRIPT_TIMEOUT;
+    }

Review Comment:
   `parseTimeout()` accepts any long value (including `0`/negative) and passes it through to `ProcessUtils.executeScript()`, where `<= 0` disables the timeout. To avoid accidental indefinite blocking, consider treating `timeout <= 0` as invalid (set an error message) or falling back to `DEFAULT_SCRIPT_TIMEOUT`. Also consider using `isNotBlank()` + `trim()` so whitespace-only values don’t get treated as an invalid number.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java:
##########
@@ -106,18 +108,42 @@ private AlertResult executeShellScript(String title, String content) {
             return alertResult;
         }
 
+        Long timeout = parseTimeout(alertResult);
+        if (timeout == null) {
+            return alertResult;
+        }
+
         String[] cmd = {"/bin/sh", "-c", scriptPath + ALERT_TITLE_OPTION + "'" + title + "'" + ALERT_CONTENT_OPTION
                 + "'" + content + "'" + ALERT_USER_PARAMS_OPTION + "'" + userParams + "'"};
-        int exitCode = ProcessUtils.executeScript(cmd);
+        int exitCode = ProcessUtils.executeScript(timeout, cmd);
 
         if (exitCode == 0) {
             alertResult.setSuccess(true);
             alertResult.setMessage("send script alert msg success");
             return alertResult;
         }
+        if (exitCode == ProcessUtils.EXECUTE_TIMEOUT_EXIT_CODE) {
+            alertResult.setMessage("send script alert msg error, script execution timed out after " + timeout
+                    + " seconds");
+            log.error("send script alert msg error, script execution timed out after {} seconds", timeout);
+            return alertResult;
+        }

Review Comment:
   Using a fixed numeric exit code (`124`) to represent an internal timeout can collide with real script exit codes (scripts can legitimately return 124). In that case the sender would incorrectly report a timeout rather than the script’s real failure reason. Consider using a sentinel exit code outside the OS exit-code range (e.g., negative) or returning a richer result type (exitCode + timedOut flag) from `ProcessUtils` to avoid ambiguity.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java:
##########
@@ -17,23 +17,52 @@
 
 package org.apache.dolphinscheduler.plugin.alert.script;
 
+import java.io.File;
+
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 /**
  * ProcessUtilsTest
  */
 public class ProcessUtilsTest {
 
-    private static final String rootPath = System.getProperty("user.dir");
+    @Test
+    public void testExecuteScript() {
+        String javaBin = getJavaBin();
+        String[] cmd = {javaBin, "-cp", System.getProperty("java.class.path"),
+                ProcessUtilsTest.class.getName() + "$SimpleMain"};
+        int code = ProcessUtils.executeScript(60, cmd);
+        Assertions.assertNotEquals(ProcessUtils.EXECUTE_ERROR_EXIT_CODE, code);
+    }
 
-    private static final String shellFilPath =
-            rootPath + "/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/test.sh";
+    @Test
+    public void testExecuteScriptTimeout() {
+        String javaBin = getJavaBin();
+        String[] sleepCmd = {javaBin, "-cp", System.getProperty("java.class.path"),
+                ProcessUtilsTest.class.getName() + "$SleepMain"};
+        int code = ProcessUtils.executeScript(2, sleepCmd);
+        Assertions.assertEquals(ProcessUtils.EXECUTE_TIMEOUT_EXIT_CODE, code);
+    }

Review Comment:
   PR description says the timeout path “returns exit code -2”, but the implementation/tests/docs use `EXECUTE_TIMEOUT_EXIT_CODE = 124`. Please update the PR description (or the code) so the documented behavior and implementation match, since this impacts how users interpret script exit codes.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4204394479

   @SbloodyS  i have fix all the issue's please again review it .
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4285868974

   I have seen all the files and according to me there was no any technical issue that i seen Can you please highlight that snippet of code that require improvement.and also the snippet you are mentioning it was also fixed i.e to add a end break line .
   and also all the test cases are passing at locally.and also made build successfully
   Thanks for your guidance @SbloodyS 


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r3013114989


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -100,4 +114,46 @@ public void testTypeIsError() {
         assertFalse(alertResult.isSuccess());
     }
 
+    @Test
+    public void testDefaultTimeout() {
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+
+    @Test
+    public void testCustomTimeout() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "30");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {

Review Comment:
   Same as [#18050 (comment)](https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624)



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -69,7 +74,12 @@ public void testUserParamsNPE() {
         ScriptSender scriptSender = new ScriptSender(scriptConfig);
         AlertResult alertResult;
         alertResult = scriptSender.sendScriptAlert("test user params NPE", "test content");
-        Assertions.assertTrue(alertResult.isSuccess());
+        if (isWindows()) {

Review Comment:
   Same as [#18050 (comment)](https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624)



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -50,7 +50,12 @@ public void testScriptSenderTest() {
         ScriptSender scriptSender = new ScriptSender(scriptConfig);
         AlertResult alertResult;
         alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
-        Assertions.assertTrue(alertResult.isSuccess());
+        if (isWindows()) {

Review Comment:
   Same as [#18050 (comment)](https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624)



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -100,4 +114,46 @@ public void testTypeIsError() {
         assertFalse(alertResult.isSuccess());
     }
 
+    @Test
+    public void testDefaultTimeout() {
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {

Review Comment:
   Same as [#18050 (comment)](https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624)



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -100,4 +114,46 @@ public void testTypeIsError() {
         assertFalse(alertResult.isSuccess());
     }
 
+    @Test
+    public void testDefaultTimeout() {
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+
+    @Test
+    public void testCustomTimeout() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "30");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+
+    @Test
+    public void testInvalidTimeoutFallsBackToDefault() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "notANumber");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        Assertions.assertFalse(alertResult.isSuccess());
+        if (isWindows()) {

Review Comment:
   Same as [#18050 (comment)](https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624)



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -88,7 +98,11 @@ public void testPathError() {
         AlertResult alertResult;
         alertResult = scriptSender.sendScriptAlert("test path NPE", "test content");
         assertFalse(alertResult.isSuccess());
-        Assertions.assertTrue(alertResult.getMessage().contains("shell script is invalid, only support .sh file"));
+        if (isWindows()) {

Review Comment:
   Same as [#18050 (comment)](https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624)



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java:
##########
@@ -17,23 +17,52 @@
 
 package org.apache.dolphinscheduler.plugin.alert.script;
 
+import java.io.File;
+
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 /**
  * ProcessUtilsTest
  */
 public class ProcessUtilsTest {
 
-    private static final String rootPath = System.getProperty("user.dir");
+    @Test
+    public void testExecuteScript() {
+        String javaBin = getJavaBin();
+        String[] cmd = {javaBin, "-cp", System.getProperty("java.class.path"),
+                ProcessUtilsTest.class.getName() + "$SimpleMain"};
+        int code = ProcessUtils.executeScript(60, cmd);
+        Assertions.assertNotEquals(ProcessUtils.EXECUTE_ERROR_EXIT_CODE, code);
+    }
 
-    private static final String shellFilPath =
-            rootPath + "/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/test.sh";
+    @Test
+    public void testExecuteScriptTimeout() {
+        String javaBin = getJavaBin();
+        String[] sleepCmd = {javaBin, "-cp", System.getProperty("java.class.path"),
+                ProcessUtilsTest.class.getName() + "$SleepMain"};
+        int code = ProcessUtils.executeScript(2, sleepCmd);
+        Assertions.assertEquals(ProcessUtils.EXECUTE_TIMEOUT_EXIT_CODE, code);
+    }
 
-    private String[] cmd = {"/bin/sh", "-c", shellFilPath + " -t 1"};
+    private static String getJavaBin() {
+        String executableName = System.getProperty("os.name").toLowerCase().contains("win")

Review Comment:
   Same as [#18050 (comment)](https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624)



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java:
##########
@@ -100,4 +114,46 @@ public void testTypeIsError() {
         assertFalse(alertResult.isSuccess());
     }
 
+    @Test
+    public void testDefaultTimeout() {
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+
+    @Test
+    public void testCustomTimeout() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "30");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        if (isWindows()) {
+            Assertions.assertFalse(alertResult.isSuccess());
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertTrue(alertResult.isSuccess());
+        }
+    }
+
+    @Test
+    public void testInvalidTimeoutFallsBackToDefault() {
+        scriptConfig.put(ScriptParamsConstants.NAME_SCRIPT_TIMEOUT, "notANumber");
+        ScriptSender scriptSender = new ScriptSender(scriptConfig);
+        AlertResult alertResult = scriptSender.sendScriptAlert("test title Kris", "test content");
+        Assertions.assertFalse(alertResult.isSuccess());
+        if (isWindows()) {
+            Assertions.assertEquals("shell script not support windows os", alertResult.getMessage());
+        } else {
+            Assertions.assertEquals("script timeout config is invalid, should be a number", alertResult.getMessage());
+        }
+    }
+
+    private boolean isWindows() {

Review Comment:
   Same as [#18050 (comment)](https://github.com/apache/dolphinscheduler/pull/18050#discussion_r2939169624)



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r3055107724


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/scriptExample.sh:
##########
@@ -31,9 +31,13 @@ done
 # Set the exit code according to your execution result, and alert needs to use it to judge the status of this alarm result
 
 
-if  [ "$t" = "error msg title" ]
-   then
-     exit 12
+if [ "$t" = "error msg title" ]; then
+    exit 12
 fi
-exit 0
+
+if [ "$t" = "timeout msg title" ]; then
+    sleep 30
+    exit 0
+fi
+
 exit 0

Review Comment:
   ```suggestion
   exit 0
   
   ```



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "bsf23003402 (via GitHub)" <gi...@apache.org>.
bsf23003402 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4388764334

   okay thanks @SbloodyS 
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4206742906

   You should run `mvn spotless:apply` to format the code. @asadjan4611 


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4066523013

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [4 New issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=18050&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=18050&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=18050&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [76.1% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=18050&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=18050&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4388473425

   https://github.com/apache/dolphinscheduler/pull/18050#discussion_r3013113247


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "asadjan4611 (via GitHub)" <gi...@apache.org>.
asadjan4611 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4207357343

   okay @SbloodyS 
   Thanks your guidance and i have done it.
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS closed pull request #18050: [Improvement-18034][alert] Add configurable timeout for script alert plugin
URL: https://github.com/apache/dolphinscheduler/pull/18050


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4210997322

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=18050&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "bsf23003402 (via GitHub)" <gi...@apache.org>.
bsf23003402 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4388451924

   @SbloodyS  can you please help me to fix this  PR 
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4132453397

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=18050&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=18050)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#discussion_r3231851931


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/pom.xml:
##########
@@ -48,6 +48,24 @@
             <artifactId>dolphinscheduler-common</artifactId>
             <scope>provided</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+            <scope>provided</scope>
+        </dependency>

Review Comment:
   We don't need this since `dolphinscheduler-common` already contains it.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement-18034][alert] Add configurable timeout for script alert plugin [dolphinscheduler]

Posted by "bsf23003402 (via GitHub)" <gi...@apache.org>.
bsf23003402 commented on PR #18050:
URL: https://github.com/apache/dolphinscheduler/pull/18050#issuecomment-4395911754

   @SbloodyS  can you please check it now and if have still any issue then please let me know 
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org