{"record":{"id":"7f084636f90cd563","repo":"apache/cassandra","slug":"threshold-must-be-greater-than-0","errorCode":null,"errorMessage":"Threshold must be greater than 0","messagePattern":"Threshold must be greater than 0","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":5062,"sourceCode":"            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 \"\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\");","sourceCodeStart":5044,"sourceCodeEnd":5080,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L5044-L5080","documentation":"setGCConcurrentPhaseLogThreshold requires a strictly positive int threshold (in ms). Zero or negative values are rejected with IllegalArgumentException because a non-positive log threshold is meaningless.","triggerScenarios":"Calling setGCConcurrentPhaseLogThreshold(0) or any negative int; often from config parsing that permits 0 as a 'disabled' sentinel.","commonSituations":"Users set gc_concurrent_phase_log_threshold: 0 in cassandra.yaml expecting it to disable GC logging; the setter rejects it.","solutions":["Pass a positive threshold value (> 0)","Use gc_concurrent_phase_warn_threshold = 0 semantics instead of log = 0 for disabling warn","Remove/omit the setting to keep defaults"],"exampleFix":"// before\nDatabaseDescriptor.setGCConcurrentPhaseLogThreshold(0);\n// after\nDatabaseDescriptor.setGCConcurrentPhaseLogThreshold(1000); // 1s","handlingStrategy":"validation","validationCode":"if (threshold <= 0) throw new IllegalArgumentException(\"gc_concurrent_phase_log_threshold must be > 0\");","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.setGCConcurrentPhaseLogThreshold(v); } catch (IllegalArgumentException e) { logger.error(\"invalid gc_concurrent_phase_log_threshold: {}\", e.getMessage()); }","preventionTips":["Never use 0 as a disable sentinel for the log threshold","Validate yaml durations are positive before loading","Reject zero/negative durations at config-parse time"],"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"}