apache/hadoop · error · EOFException
EOF Reached. file size is {} and {} more bytes left to be tr
Error message
EOF Reached. file size is {} and {} more bytes left to be transfered. What it means
Error "EOF Reached. file size is {} and {} more bytes left to be transfered." thrown in apache/hadoop.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/SocketOutputStream.java:227
* Ideally we should wait after transferTo returns 0. But because of
* a bug in JRE on Linux (http://bugs.sun.com/view_bug.do?bug_id=5103988),
* which throws an exception instead of returning 0, we wait for the
* channel to be writable before writing to it. If you ever see
* IOException with message "Resource temporarily unavailable"
* thrown here, please let us know.
*
* Once we move to JAVA SE 7, wait should be moved to correct place.
*/
long start = System.nanoTime();
waitForWritable();
long wait = System.nanoTime();
int nTransfered = (int) fileCh.transferTo(position, count, getChannel());
if (nTransfered == 0) {
//check if end of file is reached.
if (position >= fileCh.size()) {
throw new EOFException("EOF Reached. file size is " + fileCh.size() +
" and " + count + " more bytes left to be " +
"transfered.");
}
//otherwise assume the socket is full.
//waitForWritable(); // see comment above.
} else if (nTransfered < 0) {
throw new IOException("Unexpected return of " + nTransfered +
" from transferTo()");
} else {
position += nTransfered;
count -= nTransfered;
}
long transfer = System.nanoTime();
waitTime += wait - start;
transferTime += transfer - wait;
}
if (waitForWritableTime != null) {View on GitHub (pinned to 2add963021)
Solutions
- Verify the source file was not truncated or modified while being transferred; re-run the transfer against a stable file.
- Check that the expected file size matches the actual bytes available on disk before starting transferTo.
- Investigate disk or filesystem errors on the source node that may cause a premature EOF.
When it happens
Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/SocketOutputStream.java:227 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/827701bbd9616cc1.
Report an issue: GitHub.