apache/cassandra · warning

Found empty ChronicleQueue file

Error message

Found empty ChronicleQueue file {}. This file wil be deleted as part of BinLog initialization.

What it means

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.

Solutions

  1. No action required - the file is deleted automatically as part of initialization.
  2. If the warning recurs frequently, investigate why the node is dying mid-write (OOM, disk full) with FQL/audit logging enabled.
  3. Monitor the binlog directory for space and configure fql_max_log_size / audit max_log_size rotation appropriately.
  4. Ensure the binlog directory persists correctly across restarts (no container volume weirdness dropping files).
Defensive patterns

Strategy: fallback

Validate before calling

// 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();

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/3ba168cce2903e2e. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/utils/binlog/BinLog.java:508

                currentPaths.remove(path);
                throw e;
            }
        }
    }

    /**
     * ChronicleQueue fails to start on cq4 files which are empty. Find such files in log dir and remove them.
     */
    private static Throwable cleanEmptyLogFiles(File directory, Throwable accumulate)
    {
        return cleanDirectory(directory, accumulate,
                              (dir) -> dir.tryList(file -> {
                                  boolean foundEmptyCq4File = !file.isDirectory()
                                                              && file.length() == 0
                                                              && file.name().endsWith(SingleChronicleQueue.SUFFIX);

                                  if (foundEmptyCq4File)
                                      logger.warn("Found empty ChronicleQueue file {}. This file wil be deleted as part of BinLog initialization.",
                                                  file.absolutePath());

                                  return foundEmptyCq4File;
                              }));
    }

    public static Throwable cleanDirectory(File directory, Throwable accumulate)
    {
        return cleanDirectory(directory, accumulate, File::tryList);
    }

    private static Throwable cleanDirectory(File directory, Throwable accumulate, Function<File, File[]> lister)
    {
        accumulate = checkDirectory(directory, accumulate);

        if (accumulate != null)
            return accumulate;

View on GitHub (pinned to 88fd0f6a0e)