{"record":{"id":"2038601b403a3818","repo":"apache/cassandra","slug":"threshold-value-for-gc-log-threshold-must-be-less","errorCode":null,"errorMessage":"Threshold value for gc_log*_threshold must be less than Integer.MAX_VALUE","messagePattern":"Threshold value for gc_log\\*_threshold must be less than Integer\\.MAX_VALUE","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":5015,"sourceCode":"    }\n\n    public static long getGCLogThreshold()\n    {\n        return conf.gc_log_threshold.toMilliseconds();\n    }\n\n    public static void setGCLogThreshold(int threshold)\n    {\n        validateGCParams(threshold, getGCWarnThreshold());\n        conf.gc_log_threshold = new DurationSpec.IntMillisecondsBound(threshold);\n    }\n\n    public static void validateGCParams(long logThreshold, long warnThreshold)\n    {\n        if (logThreshold <= 0)\n            throw new IllegalArgumentException(\"Threshold value for gc_log*_threshold must be greater than 0\");\n        if (logThreshold > Integer.MAX_VALUE)\n            throw new IllegalArgumentException(\"Threshold value for gc_log*_threshold must be less than Integer.MAX_VALUE\");\n\n        if (warnThreshold <= 0)\n            throw new IllegalArgumentException(\"Threshold value for gc_warn*_threshold must be greater than 0\");\n        if (warnThreshold > Integer.MAX_VALUE)\n            throw new IllegalArgumentException(\"Threshold value for gc_warn*_threshold must be less than Integer.MAX_VALUE\");\n\n        if (warnThreshold != 0 && logThreshold > warnThreshold)\n            throw new IllegalArgumentException(\"Threshold value for gc_log*_threshold (\" + logThreshold + \") must be less than gc_warn*_threshold which is currently \"\n                    + warnThreshold);\n    }\n\n    public static EncryptionContext getEncryptionContext()\n    {\n        return encryptionContext;\n\n    }\n\n    public static long getGCWarnThreshold()","sourceCodeStart":4997,"sourceCodeEnd":5033,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L4997-L5033","documentation":"Cassandra throws this IllegalArgumentException from validateGCParams when the GC log threshold exceeds Integer.MAX_VALUE milliseconds. Thresholds are stored as int millisecond bounds, so values above the int range cannot be represented.","triggerScenarios":"Calling validateGCParams with logThreshold > 2147483647, typically from a misconfigured gc_log_threshold in cassandra.yaml (e.g. value given in a unit that resolves to billions of ms) or a programmatic call passing Long values.","commonSituations":"Unit confusion (nanoseconds/microseconds pasted into a ms field) or computing the threshold from a formula without clamping.","solutions":["Set gc_log_threshold below Integer.MAX_VALUE ms (~24.8 days)","Verify the unit suffix in cassandra.yaml (e.g. 200ms, not 200000000000ns)","Clamp or validate long values before calling validateGCParams"],"exampleFix":"// before\nvalidateGCParams(5_000_000_000L, 10_000_000_000L);\n// after\nvalidateGCParams(200L, 1000L);","handlingStrategy":"validation","validationCode":"if (logThreshold > Integer.MAX_VALUE)\n    logThreshold = Integer.MAX_VALUE; // or reject","typeGuard":null,"tryCatchPattern":"try {\n    DatabaseDescriptor.validateGCParams(logThreshold, warnThreshold);\n} catch (IllegalArgumentException e) {\n    logger.error(\"gc_log_threshold out of int range\", e);\n}","preventionTips":["Express thresholds in milliseconds with correct unit suffixes","Clamp long inputs to Integer.MAX_VALUE before validating","Avoid unit (ns/us) copy-paste errors in cassandra.yaml"],"tags":["configuration","gc","overflow"],"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"}