apache/dolphinscheduler · error · EmrTaskException
cancel emr step failed
Error message
cancel emr step failed
What it means
Sentinel guard in cancelApplication: emrClient.cancelSteps returned null (or the cancellation request itself was rejected), so the EMR step cancel cannot be confirmed. It is the AWS-side cancel path failing — SDK error, credentials, or the step/cluster already gone — distinct from the later guard that inspects CancelStepsInfo for an error reason.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrAddStepsTask.java:196
DescribeStepResult result = emrClient.describeStep(describeStepRequest);
if (result == null) {
throw new EmrTaskException("fetch step status failed");
}
StepStatus stepStatus = result.getStep().getStatus();
log.info("emr step [clusterId:{}, stepId:{}] running with status:{}", clusterId, stepId, stepStatus);
return stepStatus;
}
@Override
public void cancelApplication() throws TaskException {
log.info("trying cancel emr step, taskId:{}, clusterId:{}, stepId:{}",
this.taskExecutionContext.getTaskInstanceId(), clusterId, stepId);
CancelStepsRequest cancelStepsRequest = new CancelStepsRequest().withClusterId(clusterId).withStepIds(stepId);
CancelStepsResult cancelStepsResult = emrClient.cancelSteps(cancelStepsRequest);
if (cancelStepsResult == null) {
throw new EmrTaskException("cancel emr step failed");
}
CancelStepsInfo cancelEmrStepInfo = cancelStepsResult.getCancelStepsInfoList()
.stream()
.filter(cancelStepsInfo -> cancelStepsInfo.getStepId().equals(stepId))
.findFirst()
.orElseThrow(() -> new EmrTaskException("cancel emr step failed"));
if (CancelStepsRequestStatus.FAILED.toString().equals(cancelEmrStepInfo.getStatus())) {
throw new EmrTaskException("cancel emr step failed, message:" + cancelEmrStepInfo.getReason());
}
log.info("the result of cancel emr step is:{}", cancelStepsResult);
}
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Check the caused-by AWS SDK exception for the concrete failure (auth, throttling, step not found)
- Verify clusterId and stepId still reference a live cluster/step before cancelling
- Retry cancellation after transient AWS errors
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrAddStepsTask.java:196 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/be59c217583101c0.
Report an issue: GitHub.