apache/hadoop · error · IOException

Failed to sync

Error message

Failed to sync ${dir}

What it means

Wraps an IOException from the file-io provider's dirSync in fsyncDirectory: the replica's parent directory changes (e.g. a just-created block file) could not be made durable on the storage device, jeopardizing crash consistency for the finalized block.

Solutions

  1. Check disk health and filesystem errors on the volume containing the directory; fsync failures usually indicate failing hardware.
  2. Ensure the filesystem is not full and the mount is still writable.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Calling sync/fsync on a replica directory fails, typically due to I/O errors on the underlying disk.

Common situations: Syncing a storage directory to disk failed, a strong signal of disk or filesystem trouble. Check dmesg and volume health immediately.


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

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplica.java:536

    //update metaFile
    try (RandomAccessFile metaRAF = fileIoProvider.getRandomAccessFile(
        volume, metaFile, "rw")) {
      metaRAF.setLength(newmetalen);
      metaRAF.seek(newmetalen - checksumsize);
      metaRAF.write(b, 0, checksumsize);
    }
  }

  /**
   * Sync the parent directory changes to durable device.
   * @throws IOException
   */
  public void fsyncDirectory() throws IOException {
    File dir = getDir();
    try {
      getFileIoProvider().dirSync(getVolume(), getDir());
    } catch (IOException e) {
      throw new IOException("Failed to sync " + dir, e);
    }
  }
}

View on GitHub (pinned to 2add963021)