{"record":{"id":"a7671c7a96e0e9d1","repo":"apache/cassandra","slug":"threshold-value-for-gc-warn-threshold-must-be-gre","errorCode":null,"errorMessage":"Threshold value for gc_warn*_threshold must be greater than 0","messagePattern":"Threshold value for gc_warn\\*_threshold must be greater than 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":5018,"sourceCode":"    {\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()\n    {\n        return conf.gc_warn_threshold.toMilliseconds();\n    }","sourceCodeStart":5000,"sourceCodeEnd":5036,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L5000-L5036","documentation":"Cassandra throws this IllegalArgumentException from validateGCParams when the GC warn threshold (gc_warn_threshold) is zero or negative. This threshold controls when a GC pause is logged at WARN level and must be a positive millisecond value (0 is special-cased only downstream, not here).","triggerScenarios":"Calling validateGCParams(logThreshold, warnThreshold) with warnThreshold <= 0, or startup validation when gc_warn_threshold in cassandra.yaml is 0 or negative.","commonSituations":"Operators setting gc_warn_threshold: 0 to disable warnings; the startup validator rejects it here even though the runtime comparison code treats 0 as disabled.","solutions":["Set gc_warn_threshold to a positive value larger than gc_log_threshold (e.g. 1000ms)","Remove a 0/negative gc_warn_threshold from cassandra.yaml","If warning suppression is truly needed, set it very high but under Integer.MAX_VALUE"],"exampleFix":"// before (cassandra.yaml)\ngc_warn_threshold: 0ms\n// after\ngc_warn_threshold: 1000ms","handlingStrategy":"validation","validationCode":"if (warnThreshold <= 0 || warnThreshold > Integer.MAX_VALUE)\n    throw new IllegalArgumentException(\"gc_warn_threshold must be > 0 and <= Integer.MAX_VALUE ms\");","typeGuard":null,"tryCatchPattern":"try {\n    DatabaseDescriptor.validateGCParams(logThreshold, warnThreshold);\n} catch (IllegalArgumentException e) {\n    logger.error(\"Invalid gc_warn_threshold\", e);\n}","preventionTips":["Keep gc_warn_threshold positive (default 1000ms)","To effectively silence warnings use a large but in-range value","Validate both thresholds together with validateGCParams"],"tags":["configuration","gc","jvm"],"backgroundTag":"invalid-config-value","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"}