apache/cassandra · warning
Failed closing stream
Error message
Failed closing stream {} What it means
FileUtils.close(Iterable) closes a list of streams, collecting the first exception and adding the rest as suppressed. When any individual close fails it logs 'Failed closing stream', then possibly rethrows the first failure as IOException via maybeFail.
Solutions
- Read the first exception (and suppressed ones) in the log for the root cause
- Free disk space / fix I/O errors if close failures are caused by flush on close
- Retry the operation (compaction, repair) after resolving the underlying issue
- Ensure callers handle the propagated IOException from FileUtils.close
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try {
FileUtils.close(streams);
} catch (IOException e) {
// first close failure is e; check e.getSuppressed() for the rest
for (Throwable s : e.getSuppressed()) log.warn("additional close failure", s);
} Prevention
- Read suppressed exceptions for full failure picture
- Ensure adequate disk space before bulk write operations
- Handle IOException from close paths in lifecycle code
- Verify filesystem health after repeated close warnings
When it happens
Trigger: Closing multiple AutoCloseables (e.g. sstable components, transaction logs) where one or more close() calls throw IOException or another Throwable.
Common situations: Compaction or streaming failure paths where several writers are closed together; disk errors while flushing final data on close.
Related errors
- Failed closing
- Attempted skipBytes() on a closed RAR
- Attempted to seek in a closed RAR
- Ballot file corrupted
- Can't open %r for reading
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/a70b630bd9ee90ef.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/io/util/FileUtils.java:289
{
close(Arrays.asList(cs));
}
public static void close(Iterable<? extends Closeable> cs) throws IOException
{
Throwable e = null;
for (Closeable c : cs)
{
try
{
if (c != null)
c.close();
}
catch (Throwable ex)
{
if (e == null) e = ex;
else e.addSuppressed(ex);
logger.warn("Failed closing stream {}", c, ex);
}
}
maybeFail(e, IOException.class);
}
public static void closeQuietly(Iterable<? extends AutoCloseable> cs)
{
for (AutoCloseable c : cs)
{
try
{
if (c != null)
c.close();
}
catch (Exception ex)
{
logger.warn("Failed closing {}", c, ex);
}View on GitHub (pinned to 88fd0f6a0e)