apache/hadoop · warning · UnsupportedOperationException
mark not supported
Error message
mark not supported
What it means
S3ARemoteInputStream.mark() always throws UnsupportedOperationException("mark not supported"). This inner stream of the prefetching S3A input stream supports positional reads and seek, but not the mark/reset protocol of java.io.InputStream.
Solutions
- Do not call mark() on this stream; use seek(getPos()) to reposition instead.
- If a library needs mark/reset, wrap the stream in BufferedInputStream (its markSupported() is true and it buffers internally).
- Check markSupported() before calling mark() in shared utility code.
- Use the public S3A FSDataInputStream API rather than the internal S3ARemoteInputStream.
Example fix
// before
stream.mark(1024); // UnsupportedOperationException on S3ARemoteInputStream
// after
if (stream.markSupported()) {
stream.mark(1024);
} else {
long markPos = stream.getPos(); // reposition with seek later
}
// or: BufferedInputStream buffered = new BufferedInputStream(stream);
// buffered.mark(1024); buffered.reset(); Defensive patterns
Strategy: validation
Validate before calling
if (stream.markSupported()) {
stream.mark(readlimit);
} else {
markPos = stream.getPos(); // fall back to seek-based checkpoint
} Prevention
- Check markSupported() before mark() in any generic stream utility.
- Prefer seek(getPos()) checkpoints on Hadoop filesystem streams.
- Wrap in BufferedInputStream when a component requires mark/reset.
When it happens
Trigger: Calling mark() on S3ARemoteInputStream directly (tests, extracted inner stream); generic libraries that unconditionally call mark() without checking markSupported() (some parsers, compression codecs).
Common situations: Third-party readers that rely on BufferedInputStream semantics being handed the raw remote stream; unit tests exercising mark on prefetch block data; debugging code that grabs the inner stream.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- reset not supported
- skip not supported
- Attempted to seek or read past the end of the file " + pos
- Cannot seek to a negative offset " + pos
- Mark not supported
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/43e3885994c52e3c.
Report an issue: GitHub.
Appendix: source
Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/prefetch/S3ARemoteInputStream.java:473
if (closed) {
throw new IOException(
name + ": " + FSExceptionMessages.STREAM_IS_CLOSED);
}
}
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)