apache/hadoop · error · EOFException
Cannot seek after EOF, contentLength:{contentLength} positio
Error message
Cannot seek after EOF, contentLength:{contentLength} position:{pos} What it means
Error "Cannot seek after EOF, contentLength:{contentLength} position:{pos}" thrown in apache/hadoop.
Source
Thrown at hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSInputStream.java:93
this.lastByteStart = -1;
reopen(0);
closed = false;
}
/**
* Reopen the wrapped stream at give position, by seeking for
* data of a part length from object content stream.
*
* @param pos position from start of a file
* @throws IOException if failed to reopen
*/
private synchronized void reopen(long pos) throws IOException {
long partSize;
if (pos < 0) {
throw new EOFException("Cannot seek at negative position:" + pos);
} else if (pos > contentLength) {
throw new EOFException("Cannot seek after EOF, contentLength:" +
contentLength + " position:" + pos);
} else if (pos + downloadPartSize > contentLength) {
partSize = contentLength - pos;
} else {
partSize = downloadPartSize;
}
if (this.buffer != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Aborting old stream to open at pos " + pos);
}
this.buffer = null;
}
boolean isRandomIO = true;
if (pos == this.expectNextPos) {
isRandomIO = false;
} else {View on GitHub (pinned to 2add963021)
Solutions
- Do not seek beyond the file length; check contentLength and limit the requested position to be within [0, contentLength].
When it happens
Trigger: Thrown at hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSInputStream.java:93 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/0227b16d4248066e.
Report an issue: GitHub.