apache/hadoop · warning · UnsupportedOperationException

reset not supported

Error message

reset not supported

What it means

S3ARemoteInputStream.reset() always throws UnsupportedOperationException("reset not supported") - the counterpart to mark() being unsupported. The prefetcher's remote input stream is repositioned exclusively via seek(); the java.io mark/reset protocol is intentionally not implemented.

Source

Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/prefetch/S3ARemoteInputStream.java:478

  protected void throwIfInvalidSeek(long pos) throws EOFException {
    if (pos < 0) {
      throw new EOFException(FSExceptionMessages.NEGATIVE_SEEK + " " + pos);
    } else if (pos > this.getBlockData().getFileSize()) {
      throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF + " " + pos);
    }
  }

  // Unsupported functions.

  @Override
  public void mark(int readlimit) {
    throw new UnsupportedOperationException("mark not supported");
  }

  @Override
  public void reset() {
    throw new UnsupportedOperationException("reset not supported");
  }

  @Override
  public long skip(long n) {
    throw new UnsupportedOperationException("skip not supported");
  }
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Never call reset() on S3ARemoteInputStream; save getPos() and seek(pos) to return.
  2. Wrap in BufferedInputStream when a component genuinely needs mark/reset.
  3. Guard shared code with if (stream.markSupported()) before using mark/reset.
  4. Operate on the public FSDataInputStream, which offers seek-based repositioning.

Example fix

// before
long p = stream.getPos();
stream.mark(1024); // throws first
stream.reset();     // would throw too

// after
long p = stream.getPos();
... read ahead ...
stream.seek(p); // reposition without mark/reset
Defensive patterns

Strategy: validation

Validate before calling

if (stream.markSupported()) {
  stream.reset();
} else {
  stream.seek(markPos); // saved from getPos() earlier
}

Prevention

When it happens

Trigger: Calling reset() after a previous mark() (which itself throws); library code that calls reset() when markSupported() returns false, violating the InputStream contract; generic parsing utilities applying mark/reset idiomatically.

Common situations: Handing the raw stream to parsers (JSON/CSV/avro readers) that reset to re-read; test helpers; wrapping layers that propagate reset() blindly.

Related errors


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