{"record":{"id":"a70b630bd9ee90ef","repo":"apache/cassandra","slug":"failed-closing-stream","errorCode":null,"errorMessage":"Failed closing stream {}","messagePattern":"Failed closing stream (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/io/util/FileUtils.java","lineNumber":289,"sourceCode":"    {\n        close(Arrays.asList(cs));\n    }\n\n    public static void close(Iterable<? extends Closeable> cs) throws IOException\n    {\n        Throwable e = null;\n        for (Closeable c : cs)\n        {\n            try\n            {\n                if (c != null)\n                    c.close();\n            }\n            catch (Throwable ex)\n            {\n                if (e == null) e = ex;\n                else e.addSuppressed(ex);\n                logger.warn(\"Failed closing stream {}\", c, ex);\n            }\n        }\n        maybeFail(e, IOException.class);\n    }\n\n    public static void closeQuietly(Iterable<? extends AutoCloseable> cs)\n    {\n        for (AutoCloseable c : cs)\n        {\n            try\n            {\n                if (c != null)\n                    c.close();\n            }\n            catch (Exception ex)\n            {\n                logger.warn(\"Failed closing {}\", c, ex);\n            }","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/util/FileUtils.java#L271-L307","documentation":"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.","triggerScenarios":"Closing multiple AutoCloseables (e.g. sstable components, transaction logs) where one or more close() calls throw IOException or another Throwable.","commonSituations":"Compaction or streaming failure paths where several writers are closed together; disk errors while flushing final data on close.","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"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n    FileUtils.close(streams);\n} catch (IOException e) {\n    // first close failure is e; check e.getSuppressed() for the rest\n    for (Throwable s : e.getSuppressed()) log.warn(\"additional close failure\", s);\n}","preventionTips":["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"],"tags":["io","resource-cleanup","close"],"backgroundTag":"file-close-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}