{"record":{"id":"bf14ec1cfbef3206","repo":"apache/cassandra","slug":"commit-log-flush-interval-must-be-positive-fms","errorCode":null,"errorMessage":"Commit log flush interval must be positive: %fms","messagePattern":"Commit log flush interval must be positive: (.+?)ms","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java","lineNumber":151,"sourceCode":"                if (modulo >= markerIntervalMillis / 2)\n                    syncIntervalMillis += markerIntervalMillis;\n            }\n            assert syncIntervalMillis % markerIntervalMillis == 0;\n            logger.debug(\"Will update the commitlog markers every {}ms and flush every {}ms\", markerIntervalMillis, syncIntervalMillis);\n        }\n        else\n        {\n            markerIntervalMillis = syncIntervalMillis;\n        }\n        this.markerIntervalNanos = NANOSECONDS.convert(markerIntervalMillis, MILLISECONDS);\n        this.syncIntervalNanos = NANOSECONDS.convert(syncIntervalMillis, MILLISECONDS);\n    }\n\n    // Separated into individual method to ensure relevant objects are constructed before this is started.\n    void start()\n    {\n        if (syncIntervalNanos < 1 && !(this instanceof BatchCommitLogService)) // permit indefinite waiting with batch, as perfectly sensible\n            throw new IllegalArgumentException(String.format(\"Commit log flush interval must be positive: %fms\",\n                                                             syncIntervalNanos * 1e-6));\n\n        SyncRunnable sync = new SyncRunnable(preciseTime);\n        executor = executorFactory().infiniteLoop(name, sync, SAFE, NON_DAEMON, SYNCHRONIZED);\n    }\n\n    class SyncRunnable implements Interruptible.Task\n    {\n        private final MonotonicClock clock;\n        private long firstLagAt = 0;\n        private long totalSyncDuration = 0; // total time spent syncing since firstLagAt\n        private long syncExceededIntervalBy = 0; // time that syncs exceeded pollInterval since firstLagAt\n        private int lagCount = 0;\n        private int syncCount = 0;\n\n        SyncRunnable(MonotonicClock clock)\n        {\n            this.clock = clock;","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java#L133-L169","documentation":"AbstractCommitLogService.start validates the computed commit log sync interval before starting its flush loop. For non-batch commit log services, an interval below 1 nanosecond is invalid, so it throws IllegalArgumentException with the interval in milliseconds. Batch mode is exempt because indefinite waiting is legitimate there.","triggerScenarios":"Configuring commitlog_sync_period_in_ms (or a derived sync interval) to 0 or a negative value in cassandra.yaml with commitlog_sync periodic (or with group sync), then starting the node.","commonSituations":"Typo in cassandra.yaml (commitlog_sync_period_in_ms: 0); template-generated configs substituting empty values; copying a batch-mode config to a periodic setup.","solutions":["Set commitlog_sync_period_in_ms in cassandra.yaml to a positive value (default 10000) when using periodic commitlog_sync","If batch durability is wanted, use commitlog_sync: batch instead, where the interval check is not applied","Validate cassandra.yaml values (ant/fill in positive integers) before rolling out config changes"],"exampleFix":"// before (cassandra.yaml)\ncommitlog_sync: periodic\ncommitlog_sync_period_in_ms: 0\n// after\ncommitlog_sync: periodic\ncommitlog_sync_period_in_ms: 10000","handlingStrategy":"validation","validationCode":"long periodMs = yaml.getLong(\"commitlog_sync_period_in_ms\");\nif (\"periodic\".equals(syncMode) && periodMs < 1)\n    throw new IllegalArgumentException(\"commitlog_sync_period_in_ms must be > 0 for periodic sync\");","typeGuard":"null","tryCatchPattern":"try { startCassandra(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Commit log flush interval\")) { /* fix cassandra.yaml and restart */ } else throw e; }","preventionTips":["Lint cassandra.yaml for positive numeric fields before deploy","Use the shipped cassandra.yaml as the canonical template","Differ batch vs periodic sync requirements in config templates"],"tags":["commitlog","configuration","startup","validation"],"backgroundTag":"value-out-of-range","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}