apache/hadoop · error · ClosedIOException
Stream is closed: <stream>
Error message
Stream is closed: <stream>
What it means
Error "Stream is closed: <stream>" thrown in apache/hadoop.
Source
Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ABlockOutputStream.java:354
* Clear the active block.
*/
private void clearActiveBlock() {
if (activeBlock != null) {
LOG.debug("Clearing active block");
}
synchronized (this) {
activeBlock = null;
}
}
/**
* Check for the stream being open.
* @throws ClosedIOException if the stream is closed.
*/
@VisibleForTesting
void checkOpen() throws ClosedIOException {
if (closed.get()) {
throw new ClosedIOException(key, "Stream is closed: " + this);
}
}
/**
* The flush operation does not trigger an upload; that awaits
* the next block being full. What it does do is call {@code flush() }
* on the current block, leaving it to choose how to react.
* <p>
* If the stream is closed, a warning is logged but the exception
* is swallowed.
* @throws IOException Any IO problem flushing the active data block.
*/
@Override
public synchronized void flush() throws IOException {
try {
checkOpen();
} catch (ClosedIOException e) {
LOG.warn("Stream closed: {}", e.getMessage());View on GitHub (pinned to 2add963021)
Solutions
- Do not write to the block output stream after close(); check calling code for use-after-close.
When it happens
Trigger: Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ABlockOutputStream.java:354 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/bb601291930ff12a.
Report an issue: GitHub.