{"record":{"id":"7b44287f93a90200","repo":"apache/cassandra","slug":"threshold-value-for-gc-concurrent-phase-warn-thres","errorCode":null,"errorMessage":"Threshold value for gc_concurrent_phase_warn_threshold must be greater than or equal to 0","messagePattern":"Threshold value for gc_concurrent_phase_warn_threshold must be greater than or equal to 0","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":5080,"sourceCode":"            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 \"\n                                               + gcConcurrentPhaseWarnThresholdInMs);\n\n        conf.gc_concurrent_phase_log_threshold = new DurationSpec.IntMillisecondsBound(threshold);\n    }\n\n    public static int getGCConcurrentPhaseWarnThreshold()\n    {\n        return conf.gc_concurrent_phase_warn_threshold.toMilliseconds();\n    }\n\n    public static void setGCConcurrentPhaseWarnThreshold(int threshold)\n    {\n        if (threshold < 0)\n            throw new IllegalArgumentException(\"Threshold value for gc_concurrent_phase_warn_threshold must be greater than or equal to 0\");\n\n        long gcConcurrentPhaseLogThresholdInMs = getGCConcurrentPhaseLogThreshold();\n        if (threshold != 0 && threshold <= gcConcurrentPhaseLogThresholdInMs)\n            throw new IllegalArgumentException(\"Threshold value for gc_concurrent_phase_warn_threshold (\" + threshold + \") must be greater than gc_concurrent_phase_log_threshold which is currently \"\n                                               + gcConcurrentPhaseLogThresholdInMs);\n\n        conf.gc_concurrent_phase_warn_threshold = new DurationSpec.IntMillisecondsBound(threshold);\n    }\n\n    public static boolean isCDCEnabled()\n    {\n        return conf.cdc_enabled;\n    }\n\n    @VisibleForTesting\n    public static void setCDCEnabled(boolean cdc_enabled)\n    {\n        conf.cdc_enabled = cdc_enabled;","sourceCodeStart":5062,"sourceCodeEnd":5098,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L5062-L5098","documentation":"setGCConcurrentPhaseWarnThreshold rejects negative values. The warn threshold (in ms) must be >= 0, where 0 disables it; negative ints indicate a bad config or conversion bug and throw IllegalArgumentException.","triggerScenarios":"Calling setGCConcurrentPhaseWarnThreshold with a negative int, e.g. from an int overflow after unit conversion or a typo like -1000 in cassandra.yaml.","commonSituations":"Overflow when converting larger time units to ms, or hand-edited config with a negative duration.","solutions":["Pass a non-negative threshold (0 disables the warning)","Fix negative values in cassandra.yaml","Check for integer overflow in unit conversion code before calling"],"exampleFix":"// before\nDatabaseDescriptor.setGCConcurrentPhaseWarnThreshold(-500);\n// after\nDatabaseDescriptor.setGCConcurrentPhaseWarnThreshold(0); // or a positive ms value","handlingStrategy":"validation","validationCode":"if (threshold < 0) throw new IllegalArgumentException(\"gc_concurrent_phase_warn_threshold must be >= 0\");","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.setGCConcurrentPhaseWarnThreshold(v); } catch (IllegalArgumentException e) { logger.error(\"invalid gc_concurrent_phase_warn_threshold: {}\", e.getMessage()); }","preventionTips":["Use 0, never a negative number, to disable the warn threshold","Check for int overflow when converting time units","Validate durations in cassandra.yaml are non-negative"],"tags":["config","validation","gc","argument-out-of-range"],"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-17T15:17:12.973Z"}