apache/hadoop · error · TaskLimitException

too much write to local file system. current value is " + lo

Error message

too much write to local file system. current value is " + localWritesCounter.getCounter() + " the limit is " + limit

What it means

When mapreduce.task.local-fs.write-limit.bytes is set to a non-negative value, the task's progress thread periodically compares the LocalFileSystem BYTES_WRITTEN counter against that limit. Exceeding it raises TaskLimitException (an IOException) to deliberately fail the task — the mechanism exists to stop runaway tasks from filling local disks. Default is -1, i.e. disabled.

Source

Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java:835

     * limits.
     * @throws TaskLimitException
     */
    protected void checkTaskLimits() throws TaskLimitException {
      // check the limit for writing to local file system
      long limit = conf.getLong(MRJobConfig.TASK_LOCAL_WRITE_LIMIT_BYTES,
              MRJobConfig.DEFAULT_TASK_LOCAL_WRITE_LIMIT_BYTES);
      if (limit >= 0) {
        Counters.Counter localWritesCounter = null;
        try {
          LocalFileSystem localFS = FileSystem.getLocal(conf);
          localWritesCounter = counters.findCounter(localFS.getScheme(),
                  FileSystemCounter.BYTES_WRITTEN);
        } catch (IOException e) {
          LOG.warn("Could not get LocalFileSystem BYTES_WRITTEN counter");
        }
        if (localWritesCounter != null
                && localWritesCounter.getCounter() > limit) {
          throw new TaskLimitException("too much write to local file system." +
                  " current value is " + localWritesCounter.getCounter() +
                  " the limit is " + limit);
        }
      }
      if (diskLimitCheckStatus != null) {
        throw new TaskLimitException(diskLimitCheckStatus);
      }
    }

    /**
     * The communication thread handles communication with the parent (Task
     * Tracker). It sends progress updates if progress has been made or if
     * the task needs to let the parent know that it's alive. It also pings
     * the parent to see if it's alive.
     */
    public void run() {
      final int MAX_RETRIES = 3;
      int remainingRetries = MAX_RETRIES;

View on GitHub (pinned to 2add963021)

Solutions

  1. Raise mapreduce.task.local-fs.write-limit.bytes (or set it to -1 to disable) if the write volume is legitimate.
  2. Reduce local writes: add/verify combiners, increase io.sort.mb to spill less often, write final outputs to HDFS rather than local scratch.
  3. Check the task's counters (File Systems/Local BYTES_WRITTEN in the job history) to see how close the task was to the limit.

Example fix

# before
mapreduce.task.local-fs.write-limit.bytes=1073741824

# after
mapreduce.task.local-fs.write-limit.bytes=10737418240
Defensive patterns

Strategy: validation

Validate before calling

// before running a write-heavy job on a limited cluster, know your budget
long limit = conf.getLong(MRJobConfig.TASK_LOCAL_WRITE_LIMIT_BYTES, -1);
if (limit >= 0) {
  LOG.info("Task local write limit is " + limit + " bytes; monitor Local BYTES_WRITTEN");
}

Try / catch

catch (TaskLimitException e) { // subclass of IOException
  // task is failed by design; either raise mapreduce.task.local-fs.write-limit.bytes
  // or reduce local writes and resubmit the job
}

Prevention

When it happens

Trigger: Admin sets mapreduce.task.local-fs.write-limit.bytes=N on a cluster and a task writes more than N bytes through the LocalFileSystem (temp files, streaming pipes, heavy spill output); the next periodic check throws.

Common situations: Disk protection policies on shared clusters; streaming/hadoop-pipes jobs that stage large local files; jobs with little combiner use producing huge spill files in mapreduce.cluster.local.dir.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/9ab5e4c076a44fc9. Report an issue: GitHub.