{"record":{"id":"084d26f0f6098241","repo":"apache/cassandra","slug":"threshold-value-for-gc-warn-threshold-must-be-les","errorCode":null,"errorMessage":"Threshold value for gc_warn*_threshold must be less than Integer.MAX_VALUE","messagePattern":"Threshold value for gc_warn\\*_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":5020,"sourceCode":"    }\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()\n    {\n        return conf.gc_warn_threshold.toMilliseconds();\n    }\n\n    public static void setGCWarnThreshold(long threshold)","sourceCodeStart":5002,"sourceCodeEnd":5038,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L5002-L5038","documentation":"Cassandra throws this IllegalArgumentException from validateGCParams when the GC warn threshold exceeds Integer.MAX_VALUE milliseconds. Like the log threshold, the warn threshold is stored as an int millisecond bound and cannot exceed the int range.","triggerScenarios":"Calling validateGCParams with warnThreshold > 2147483647, from cassandra.yaml gc_warn_threshold misconfigured with wrong units or an unclamped long.","commonSituations":"Unit confusion (e.g. entering nanoseconds), or attempts to 'effectively disable' warnings with an astronomically large value.","solutions":["Set gc_warn_threshold below Integer.MAX_VALUE ms","Use a large but sane value like 600000ms (10 minutes) to suppress most warnings","Validate the parsed value before calling validateGCParams"],"exampleFix":"// before\nvalidateGCParams(200L, 3_000_000_000L);\n// after\nvalidateGCParams(200L, 600_000L);","handlingStrategy":"validation","validationCode":"if (warnThreshold > Integer.MAX_VALUE)\n    warnThreshold = Integer.MAX_VALUE; // or reject","typeGuard":null,"tryCatchPattern":"try {\n    DatabaseDescriptor.validateGCParams(logThreshold, warnThreshold);\n} catch (IllegalArgumentException e) {\n    logger.error(\"gc_warn_threshold out of int range\", e);\n}","preventionTips":["Clamp warn threshold to Integer.MAX_VALUE ms","Use sane magnitudes (e.g. 60000-600000 ms)","Check unit suffixes 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"}