{"record":{"id":"3ba168cce2903e2e","repo":"apache/cassandra","slug":"found-empty-chroniclequeue-file-this-file-wil","errorCode":null,"errorMessage":"Found empty ChronicleQueue file {}. This file wil be deleted as part of BinLog initialization.","messagePattern":"Found empty ChronicleQueue file (.+?)\\. This file wil be deleted as part of BinLog initialization\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/utils/binlog/BinLog.java","lineNumber":508,"sourceCode":"                currentPaths.remove(path);\n                throw e;\n            }\n        }\n    }\n\n    /**\n     * ChronicleQueue fails to start on cq4 files which are empty. Find such files in log dir and remove them.\n     */\n    private static Throwable cleanEmptyLogFiles(File directory, Throwable accumulate)\n    {\n        return cleanDirectory(directory, accumulate,\n                              (dir) -> dir.tryList(file -> {\n                                  boolean foundEmptyCq4File = !file.isDirectory()\n                                                              && file.length() == 0\n                                                              && file.name().endsWith(SingleChronicleQueue.SUFFIX);\n\n                                  if (foundEmptyCq4File)\n                                      logger.warn(\"Found empty ChronicleQueue file {}. This file wil be deleted as part of BinLog initialization.\",\n                                                  file.absolutePath());\n\n                                  return foundEmptyCq4File;\n                              }));\n    }\n\n    public static Throwable cleanDirectory(File directory, Throwable accumulate)\n    {\n        return cleanDirectory(directory, accumulate, File::tryList);\n    }\n\n    private static Throwable cleanDirectory(File directory, Throwable accumulate, Function<File, File[]> lister)\n    {\n        accumulate = checkDirectory(directory, accumulate);\n\n        if (accumulate != null)\n            return accumulate;\n","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/utils/binlog/BinLog.java#L490-L526","documentation":"During BinLog (full query log / audit log built on Chronicle Queue) initialization, cleanEmptyLogFiles scans the log directory for zero-length .cq4 files and logs a warning for each before deleting them. Empty queue files are leftover artifacts (e.g. from a crash or OOM) and are safe to remove so Chronicle Queue can initialize cleanly.","triggerScenarios":"Starting a node with full query logging or audit logging enabled when the binlog directory contains a 0-byte file ending in Chronicle Queue's .cq4 suffix - typically left by an unclean shutdown or disk-full condition during a previous run.","commonSituations":"Node crashed while FQL was active; disk filled mid-write leaving empty cq4 files; copying binlog archives without the data; container restarts with a mounted empty-file artifact.","solutions":["No action required - the file is deleted automatically as part of initialization.","If the warning recurs frequently, investigate why the node is dying mid-write (OOM, disk full) with FQL/audit logging enabled.","Monitor the binlog directory for space and configure fql_max_log_size / audit max_log_size rotation appropriately.","Ensure the binlog directory persists correctly across restarts (no container volume weirdness dropping files)."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// pre-start check: remove zero-byte cq4 files from the binlog dir: File[] empties = dir.listFiles((d, n) -> n.endsWith(\".cq4\") && new File(d, n).length() == 0); if (empties != null) for (File f : empties) f.delete();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure clean shutdown of nodes running FQL/audit logging.","Monitor binlog directory disk usage to avoid mid-write failures.","Configure log size rotation so files close cleanly.","Alert on recurring empty-cq4 warnings - they indicate crashes during logging."],"tags":["binlog","chronicle-queue","fql","logging","cleanup"],"backgroundTag":"file-already-exists","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"}