apache/cassandra · error · IllegalArgumentException

commit log sync marker's current file position %d is greater

Error message

commit log sync marker's current file position %d is greater than next file position %d

What it means

writeSyncMarker asserts an ordering invariant when stamping a sync marker into the commit log buffer: the file position where the marker is written must not exceed the position of the next marker. Throwing IllegalArgumentException means the segment's offset bookkeeping (lastMarkerOffset/allocatePosition arithmetic) is inconsistent — an internal bug, not operator error.

Source

Thrown at src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java:410

            if (!CommitLog.handleCommitError("Failed to sync CDC Index: " + desc.cdcIndexFileName(), e))
                throw new RuntimeException(e);
        }
    }

    /**
     * Create a sync marker to delineate sections of the commit log, typically created on each sync of the file.
     * The sync marker consists of a file pointer to where the next sync marker should be (effectively declaring the length
     * of this section), as well as a CRC value.
     *
     * @param buffer buffer in which to write out the sync marker.
     * @param offset Offset into the {@code buffer} at which to write the sync marker.
     * @param filePos The current position in the target file where the sync marker will be written (most likely different from the buffer position).
     * @param nextMarker The file position of where the next sync marker should be.
     */
    protected static void writeSyncMarker(long id, ByteBuffer buffer, int offset, int filePos, int nextMarker)
    {
        if (filePos > nextMarker)
            throw new IllegalArgumentException(String.format("commit log sync marker's current file position %d is greater than next file position %d", filePos, nextMarker));
        CRC32 crc = new CRC32();
        updateChecksumInt(crc, (int) (id & 0xFFFFFFFFL));
        updateChecksumInt(crc, (int) (id >>> 32));
        updateChecksumInt(crc, filePos);
        buffer.putInt(offset, nextMarker);
        buffer.putInt(offset + 4, (int) crc.getValue());
    }

    abstract void write(int lastSyncedOffset, int nextMarker);

    abstract void flush(int startMarker, int nextMarker);

    public boolean isStillAllocating()
    {
        return allocatePosition.get() < endOfBuffer;
    }

    /**

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Report to the Cassandra project with logs/stack trace — this is an internal invariant failure.
  2. Remove any custom patches to CommitLogSegment/CommitLogAllocator and retest on unmodified code.
  3. Upgrade to the latest release where sync-marker races have been addressed.
  4. Recover data by replaying intact segments; discard the corrupt segment.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    CommitLogSegment.writeSyncMarker(id, buffer, offset, filePos, nextMarker);
} catch (IllegalArgumentException e) {
    logger.error("Sync marker invariant violated (internal bug): {}", e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: CommitLogSegment.writeSyncMarker called with filePos > nextMarker, arising from corrupted marker-offset tracking under concurrent allocation or from a patched/subclassed segment implementation.

Common situations: Bugs in commit log allocation racing with periodic sync; custom or experimental patches to CommitLogSegment; memory corruption or faulty low-level tooling rewriting buffers.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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