{"record":{"id":"b4b8a66572f76f12","repo":"apache/cassandra","slug":"threshold-value-for-gc-warn-threshold-d-must-be","errorCode":null,"errorMessage":"Threshold value for gc_warn_threshold (%d) must be greater than gc_log_threshold which is currently %d","messagePattern":"Threshold value for gc_warn_threshold \\((.+?)\\) must be greater than gc_log_threshold which is currently (.+?)","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":5048,"sourceCode":"\n    }\n\n    public static long getGCWarnThreshold()\n    {\n        return conf.gc_warn_threshold.toMilliseconds();\n    }\n\n    public static void setGCWarnThreshold(long threshold)\n    {\n        if (threshold < 0)\n            throw new IllegalArgumentException(\"Threshold value for gc_warn_threshold must be greater than or equal to 0\");\n\n        if (threshold > Integer.MAX_VALUE)\n            throw new IllegalArgumentException(\"Threshold must be less than Integer.MAX_VALUE\");\n\n        long gcLogThresholdInMs = getGCLogThreshold();\n        if (threshold != 0 && threshold <= gcLogThresholdInMs)\n            throw new IllegalArgumentException(\"Threshold value for gc_warn_threshold (\" + threshold + \") must be greater than gc_log_threshold which is currently \"\n                                               + gcLogThresholdInMs);\n\n        conf.gc_warn_threshold = new DurationSpec.IntMillisecondsBound(threshold);\n    }\n\n    public static int getGCConcurrentPhaseLogThreshold()\n    {\n        return conf.gc_concurrent_phase_log_threshold.toMilliseconds();\n    }\n\n    public static void setGCConcurrentPhaseLogThreshold(int threshold)\n    {\n        if (threshold <= 0)\n            throw new IllegalArgumentException(\"Threshold must be greater than 0\");\n\n        long gcConcurrentPhaseWarnThresholdInMs = getGCConcurrentPhaseWarnThreshold();\n        if (gcConcurrentPhaseWarnThresholdInMs != 0 && threshold > gcConcurrentPhaseWarnThresholdInMs)\n            throw new IllegalArgumentException(\"Threshold value for gc_concurrent_phase_log_threshold (\" + threshold + \") must be less than gc_concurrent_phase_warn_threshold which is currently \"","sourceCodeStart":5030,"sourceCodeEnd":5066,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L5030-L5066","documentation":"setGCWarnThreshold enforces that gc_warn_threshold is strictly greater than the current gc_log_threshold whenever the warn threshold is non-zero. Setting it equal to or below gc_log_threshold is rejected because the warn threshold must fire before the log threshold.","triggerScenarios":"Calling setGCWarnThreshold(threshold) where threshold != 0 and threshold <= DatabaseDescriptor.getGCLogThreshold(); e.g. setting warn=10000ms while gc_log_threshold is 20000ms.","commonSituations":"Editing cassandra.yaml so gc_warn_threshold ends up lower than gc_log_threshold, or updating one threshold programmatically without reordering both.","solutions":["Raise gc_warn_threshold so it is strictly greater than getGCLogThreshold()","Lower gc_log_threshold first via setGCLogThreshold before setting the warn threshold","Set gc_warn_threshold to 0 to disable it","Reorder calls: set the log threshold after the warn threshold"],"exampleFix":"// before\nDatabaseDescriptor.setGCLogThreshold(20000);\nDatabaseDescriptor.setGCWarnThreshold(10000); // throws\n// after\nDatabaseDescriptor.setGCWarnThreshold(30000);\nDatabaseDescriptor.setGCLogThreshold(20000);","handlingStrategy":"validation","validationCode":"if (warnMs != 0 && warnMs <= DatabaseDescriptor.getGCLogThreshold()) throw new IllegalArgumentException(\"gc_warn_threshold must exceed gc_log_threshold\");","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.setGCWarnThreshold(warn); } catch (IllegalArgumentException e) { logger.error(\"gc threshold ordering violated: {}\", e.getMessage()); }","preventionTips":["Always set the warn threshold before the log threshold","Read current values with getGCLogThreshold() before updating","Keep gc_warn_threshold > gc_log_threshold > 0 in cassandra.yaml"],"tags":["config","validation","gc","conflicting-config-options"],"backgroundTag":"conflicting-config-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}