{"record":{"id":"4e70727df7e77c57","repo":"apache/cassandra","slug":"threshold-value-for-gc-log-threshold-must-be-grea","errorCode":null,"errorMessage":"Threshold value for gc_log*_threshold must be greater than 0","messagePattern":"Threshold value for gc_log\\*_threshold must be greater than 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":5013,"sourceCode":"    {\n        conf.user_function_timeout_policy = userFunctionTimeoutPolicy;\n    }\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    }","sourceCodeStart":4995,"sourceCodeEnd":5031,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L4995-L5031","documentation":"Cassandra throws this IllegalArgumentException from validateGCParams when the GC log threshold (gc_log_threshold in ms) is zero or negative. This threshold controls how long a GC pause must be before it is logged; it must be a positive value.","triggerScenarios":"Calling DatabaseDescriptor.validateGCParams(logThreshold, warnThreshold) with logThreshold <= 0; also triggered during startup when gc_log_threshold in cassandra.yaml is 0 or negative.","commonSituations":"Operators setting gc_log_threshold: 0 believing 0 disables GC logging, or typos like a leading minus sign in cassandra.yaml.","solutions":["Set gc_log_threshold to a positive millisecond value (e.g. 200)","Check cassandra.yaml for gc_log_threshold and remove 0/negative values","For JMX runtime updates, pass a positive long to the setter before re-validating"],"exampleFix":"// before (cassandra.yaml)\ngc_log_threshold: 0ms\n// after\ngc_log_threshold: 200ms","handlingStrategy":"validation","validationCode":"if (logThreshold <= 0 || logThreshold > Integer.MAX_VALUE)\n    throw new IllegalArgumentException(\"gc_log_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 thresholds in cassandra.yaml\", e);\n    throw e; // fail fast before node startup proceeds\n}","preventionTips":["Keep gc_log_threshold a positive ms value (default 200ms)","Never use 0 thinking it disables logging","Run validateGCParams on parsed config before startup"],"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"}