apache/hadoop · error · UnsupportedOperationException
Killing tasks in LocalJobRunner is not supported
Error message
Killing tasks in LocalJobRunner is not supported
What it means
LocalJobRunner.killTask(TaskAttemptID, boolean) unconditionally throws UnsupportedOperationException: the local runner executes all tasks on threads of one Job thread, so individual task attempts cannot be killed or failed independently. Job-level kill is supported — killJob() sets the Job.killed flag and interrupts the worker thread.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java:814
return job.status;
}
public void killJob(org.apache.hadoop.mapreduce.JobID id) {
jobs.get(JobID.downgrade(id)).killed = true;
jobs.get(JobID.downgrade(id)).interrupt();
}
public void setJobPriority(org.apache.hadoop.mapreduce.JobID id,
String jp) throws IOException {
throw new UnsupportedOperationException("Changing job priority " +
"in LocalJobRunner is not supported.");
}
/** Throws {@link UnsupportedOperationException} */
public boolean killTask(org.apache.hadoop.mapreduce.TaskAttemptID taskId,
boolean shouldFail) throws IOException {
throw new UnsupportedOperationException("Killing tasks in " +
"LocalJobRunner is not supported");
}
public org.apache.hadoop.mapreduce.TaskReport[] getTaskReports(
org.apache.hadoop.mapreduce.JobID id, TaskType type) {
return new org.apache.hadoop.mapreduce.TaskReport[0];
}
public org.apache.hadoop.mapreduce.JobStatus getJobStatus(
org.apache.hadoop.mapreduce.JobID id) {
Job job = jobs.get(JobID.downgrade(id));
if(job != null)
return job.status;
else
return null;
}
public org.apache.hadoop.mapreduce.Counters getJobCounters(View on GitHub (pinned to 2add963021)
Solutions
- Kill the whole job instead (JobClient.killJob) when running locally
- Run the test on a real or mini YARN cluster (MiniYARNCluster / mapreduce.framework.name=yarn) when per-task kill semantics are required
- Guard the call behind a framework-name check before invoking
Example fix
// before
client.killTask(attemptId, false); // throws in local mode
// after
if ("local".equals(conf.get("mapreduce.framework.name", "local"))) {
client.killJob(jobId); // only job-level kill exists locally
} else {
client.killTask(attemptId, false);
} Defensive patterns
Strategy: validation
Validate before calling
if (!"local".equals(conf.get("mapreduce.framework.name", "local"))) {
client.killTask(attemptId, false);
} else {
client.killJob(jobId); // local runner: job-level kill only
} Try / catch
try {
client.killTask(attemptId, shouldFail);
} catch (UnsupportedOperationException e) {
LOG.warn("Per-task kill unsupported locally; killing job instead");
client.killJob(jobId);
} Prevention
- Run retry/kill-semantics tests on MiniYARNCluster, not LocalJobRunner
- Centralize framework-mode checks in one helper used by all job-control code
When it happens
Trigger: Calling JobClient.killTask(attemptId, shouldFail), killTaskAttempt, or 'hadoop job -kill-task' / '-fail-task' against a job whose framework is local.
Common situations: Test harnesses that mimic cluster administration (kill a mapper to test retry logic) but run under LocalJobRunner; porting cluster-operations tooling to a local dev setup; retry-behavior tests that must instead run on MiniYARNCluster.
Related errors
- Changing job priority in LocalJobRunner is not supported.
- Not supported
- getShuffleFinishTime() not supported for MapTask
- setShuffleFinishTime() not supported for MapTask
- getMapFinishTime() not supported for ReduceTask
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/ad160d90fee7a868.
Report an issue: GitHub.