apache/dolphinscheduler · warning · TaskException

EMR Serverless task tracking interrupted

Error message

EMR Serverless task tracking interrupted

What it means

The polling loop in trackApplicationStatus sleeps 10 seconds between GetJobRun calls; if that sleep is interrupted (thread interrupt), the plugin restores the interrupt flag and rethrows as a TaskException with this message. This is the plugin's cooperative-cancellation path — usually the workflow/task instance was killed or the worker is shutting down.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-emr-serverless/src/main/java/org/apache/dolphinscheduler/plugin/task/emrserverless/EmrServerlessTask.java:176

            }

            String currentState = getJobRunState();
            while (WAITING_STATES.contains(currentState)) {
                TimeUnit.SECONDS.sleep(10);
                currentState = getJobRunState();
            }

            final int exitCode = mapStateToExitCode(currentState);
            setExitStatusCode(exitCode);
            log.info("EMR Serverless job run [{}] finished with state: {}, exitCode: {}",
                    jobRunId, currentState, exitCode);

        } catch (EmrServerlessTaskException | SdkBaseException e) {
            log.error("EMR Serverless task tracking failed", e);
            setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new TaskException("EMR Serverless task tracking interrupted", e);
        }
    }

    @Override
    public void cancelApplication() throws TaskException {
        if (StringUtils.isEmpty(jobRunId)) {
            log.warn("jobRunId is empty, skip cancel");
            return;
        }
        log.info("Cancelling EMR Serverless job run, applicationId: {}, jobRunId: {}",
                emrServerlessParameters.getApplicationId(), jobRunId);
        try {
            CancelJobRunRequest request = new CancelJobRunRequest()
                    .withApplicationId(emrServerlessParameters.getApplicationId())
                    .withJobRunId(jobRunId);
            CancelJobRunResult result = emrServerlessClient.cancelJobRun(request);
            log.info("Cancel job run result: {}", result);
        } catch (SdkBaseException e) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Expected behavior on kill — no code fix needed; the underlying AWS job run continues, so cancel it via cancelApplication or the AWS console if it should not finish
  2. If unexpected, check worker logs for shutdown/kill events around the interruption time
  3. If job runs should survive kills, monitor and cancel orphaned EMR Serverless job runs externally
  4. Ensure task timeout settings align with expected job duration so the scheduler does not kill long-running jobs mid-poll
Defensive patterns

Strategy: try-catch

Try / catch

try {
    task.trackApplicationStatus();
} catch (TaskException e) {
    if (e.getCause() instanceof InterruptedException) {
        log.warn("Tracking interrupted (task killed); AWS job run may still be active — cancel if needed");
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Thread.interrupt() delivered while TimeUnit.SECONDS.sleep(10) is blocked inside the WAITING_STATES polling loop — a task kill, workflow stop, or worker shutdown.

Common situations: User clicks stop/kill on the running workflow instance; worker graceful shutdown drains running tasks; watchdog timeout interrupts the task thread.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/7bf691a255a68584. Report an issue: GitHub.