Skip to content

[Improvement][alert] Script alert plugin can hang indefinitely (no process timeout) and exhaust alert sender threads #18034

@asadjan4611

Description

@asadjan4611

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

The Script Alert Plugin executes external scripts to send alerts. The process execution waits indefinitely (blocking waitFor()), and there is no configurable timeout. If a script hangs (network stall, deadlock, etc.), it can permanently occupy a thread in the alert sender thread pool, degrading or blocking alert delivery.

References:

  • dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java
  • dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java

What you expected to happen

  • Script execution should support a configurable timeout.
  • When timeout occurs, the process should be terminated and an error should be reported in the alert result/logs.

How to reproduce

  1. Configure Script Alert Plugin with a script that never exits (e.g., sleep 999999 or a script that blocks on I/O).
  2. Trigger multiple alerts.
  3. Observe alert sending threads get stuck and alerts stop being delivered promptly.

Anything else

Acceptance criteria:

  • Add a configurable timeout parameter for the script plugin (documented and exposed consistently).
  • Implement process timeout handling (destroy process + cleanup stream gobblers) and return a clear failure message.
  • Add unit/integration test(s) verifying timeout behavior.

Version

dev

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

backendimprovementmake more easy to user or prompt friendly

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions