{"record":{"id":"f71c8e89fc20810c","repo":"apache/cassandra","slug":"couldn-t-read-from-temporary-stress-log-file","errorCode":null,"errorMessage":"Couldn't read from temporary stress log file","messagePattern":"Couldn't read from temporary stress log file","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/StressGraph.java","lineNumber":234,"sourceCode":"                    if (currentThreadCount == null)\n                        json.put(\"revision\", stressSettings.graph.revision);\n                    else\n                        json.put(\"revision\", String.format(\"%s - %s threads\", stressSettings.graph.revision, currentThreadCount));\n                    String command = StringUtils.join(stressArguments, \" \").replaceAll(\"password=.*? \", \"password=******* \");\n                    json.put(\"command\", command);\n                    json.set(\"intervals\", intervals);\n                    stats.add(json);\n\n                    //Start fresh for next iteration:\n                    json = JsonUtils.JSON_OBJECT_MAPPER.createObjectNode();\n                    intervals = JsonUtils.JSON_OBJECT_MAPPER.createArrayNode();\n                    mode = ReadingMode.START;\n                }\n            }\n        }\n        catch (IOException e)\n        {\n            throw new RuntimeException(\"Couldn't read from temporary stress log file\");\n        }\n        if (json.size() != 0) stats.add(json);\n        return stats;\n    }\n\n    private ObjectNode createJSONStats(ObjectNode json)\n    {\n        try (InputStream logStream = Files.newInputStream(stressSettings.graph.temporaryLogFile.toPath()))\n        {\n            ArrayNode stats;\n            if (json == null)\n            {\n                json = JsonUtils.JSON_OBJECT_MAPPER.createObjectNode();\n                stats = JsonUtils.JSON_OBJECT_MAPPER.createArrayNode();\n            }\n            else\n            {\n                stats = (ArrayNode) json.get(\"stats\");","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/StressGraph.java#L216-L252","documentation":"StressGraph.parseLogStats reads the temporary stress log line by line while building graph stats; any IOException during reading is rethrown as RuntimeException 'Couldn't read from temporary stress log file'. The cause is discarded, so the real read failure (file vanished, closed handle, permissions) is invisible. It is thrown after the parsing loop, meaning the log became unreadable partway through.","triggerScenarios":"createJSONStats -> parseLogStats reads the temporary log produced during the stress run; the temp file is deleted concurrently (cleanup, tmpwatch), is on a full/failed filesystem, or the stream errors mid-read.","commonSituations":"Long stress graphing runs while /tmp cleanup removes the temporary log; multiple stress instances clobbering each other's temp files; container tmpfs limits; disk errors.","solutions":["Rerun the stress/graph operation ensuring the temporary log file is not deleted or cleaned during the run.","Point temp storage at a stable directory (not aggressive tmp-cleanup locations) with sufficient space.","Avoid running concurrent stress graph jobs sharing the same temporary log path.","Patch the catch to chain the cause: new RuntimeException(\"Couldn't read from temporary stress log file\", e)."],"exampleFix":"// before\ncatch (IOException e)\n{\n    throw new RuntimeException(\"Couldn't read from temporary stress log file\");\n}\n// after\ncatch (IOException e)\n{\n    throw new RuntimeException(\"Couldn't read from temporary stress log file\", e);\n}","handlingStrategy":"retry","validationCode":"java.io.File tmp = logFile; if (tmp != null && !tmp.canRead()) throw new IllegalStateException(\"Temporary stress log unreadable before parsing: \" + tmp);","typeGuard":null,"tryCatchPattern":"try { graph.generate(); } catch (RuntimeException e) { if (e.getMessage().contains(\"Couldn't read from temporary stress log\")) System.err.println(\"Temp log lost; rerun stress with graphing enabled and disable /tmp cleaners\"); throw e; }","preventionTips":["Disable aggressive /tmp cleanup (tmpwatch/systemd-tmpfiles) during long stress runs.","Use unique temp paths per concurrent stress job.","Keep temp storage on reliable, adequately sized filesystems."],"tags":["io","file-read","temp-file"],"backgroundTag":"file-read-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"}