apache/hadoop · error · UnsupportedOperationException

Cannot recoverLease through a symlink to a non-DistributedFi

Error message

Cannot recoverLease through a symlink to a non-DistributedFileSystem: 

What it means

Error "Cannot recoverLease through a symlink to a non-DistributedFileSystem: " thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java:333

   * @return true if the file is already closed
   * @throws IOException if an error occurs
   */
  @Override
  public boolean recoverLease(final Path f) throws IOException {
    Path absF = fixRelativePart(f);
    return new FileSystemLinkResolver<Boolean>() {
      @Override
      public Boolean doCall(final Path p) throws IOException{
        return dfs.recoverLease(getPathName(p));
      }
      @Override
      public Boolean next(final FileSystem fs, final Path p)
          throws IOException {
        if (fs instanceof DistributedFileSystem) {
          DistributedFileSystem myDfs = (DistributedFileSystem)fs;
          return myDfs.recoverLease(p);
        }
        throw new UnsupportedOperationException("Cannot recoverLease through" +
            " a symlink to a non-DistributedFileSystem: " + f + " -> " + p);
      }
    }.resolve(this, absF);
  }

  @Override
  public FSDataInputStream open(Path f, final int bufferSize)
      throws IOException {
    statistics.incrementReadOps(1);
    storageStatistics.incrementOpCounter(OpType.OPEN);
    Path absF = fixRelativePart(f);
    return new FileSystemLinkResolver<FSDataInputStream>() {
      @Override
      public FSDataInputStream doCall(final Path p) throws IOException {
        final DFSInputStream dfsis =
            dfs.open(getPathName(p), bufferSize, verifyChecksum);
        try {
          return dfs.createWrappedInputStream(dfsis);

View on GitHub (pinned to 2add963021)

Solutions

  1. Call recoverLease on the real HDFS path, not on a symlink pointing to another filesystem.
  2. Resolve the symlink target and confirm it belongs to a DistributedFileSystem before recovering the lease.

When it happens

Trigger: recoverLease is called on a path that is a symlink whose target resolves to a non-DistributedFileSystem, which HDFS cannot operate on.

Common situations: See trigger scenarios.


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