apache/hadoop · error · IOException
Stream is closed!
Error message
Stream is closed!
What it means
Error "Stream is closed!" thrown in apache/hadoop.
Source
Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsInputStream.java:250
/**
* Retrieves the handler responsible for processing vectored read requests.
* @return the {@link VectoredReadHandler} instance associated with the buffer manager.
*/
VectoredReadHandler getVectoredReadHandler() {
return getReadBufferManager().getVectoredReadHandler();
}
@Override
public int read(long position, byte[] buffer, int offset, int length)
throws IOException {
// When bufferedPreadDisabled = true, this API does not use any shared buffer,
// cursor position etc. So this is implemented as NOT synchronized. HBase
// kind of random reads on a shared file input stream will greatly get
// benefited by such implementation.
// Strict close check at the begin of the API only not for the entire flow.
synchronized (this) {
if (closed) {
throw new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
}
}
LOG.debug("pread requested offset = {} len = {} bufferedPreadDisabled = {}",
offset, length, bufferedPreadDisabled);
if (!bufferedPreadDisabled) {
return super.read(position, buffer, offset, length);
}
validatePositionedReadArgs(position, buffer, offset, length);
if (length == 0) {
return 0;
}
if (streamStatistics != null) {
streamStatistics.readOperationStarted();
}
TracingContext tc = new TracingContext(tracingContext);
tc.setReadType(ReadType.DIRECT_READ);
int bytesRead = readRemote(position, buffer, offset, length, tc);
if (statistics != null) {View on GitHub (pinned to 2add963021)
Solutions
- Do not read from the stream after close(); open a new stream instead.
- Check application logic for use-after-close, especially in finally blocks and retries.
When it happens
Trigger: A read is attempted on an ABFS input stream that was already closed.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/dd1d777a4a5911bc.
Report an issue: GitHub.