apache/cassandra · error · java.lang.IllegalArgumentException

Threshold must be greater than 0

Error message

Threshold must be greater than 0

What it means

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.

Solutions

  1. Pass a positive threshold value (> 0)
  2. Use gc_concurrent_phase_warn_threshold = 0 semantics instead of log = 0 for disabling warn
  3. Remove/omit the setting to keep defaults

Example fix

// before
DatabaseDescriptor.setGCConcurrentPhaseLogThreshold(0);
// after
DatabaseDescriptor.setGCConcurrentPhaseLogThreshold(1000); // 1s
Defensive patterns

Strategy: validation

Validate before calling

if (threshold <= 0) throw new IllegalArgumentException("gc_concurrent_phase_log_threshold must be > 0");

Try / catch

try { DatabaseDescriptor.setGCConcurrentPhaseLogThreshold(v); } catch (IllegalArgumentException e) { logger.error("invalid gc_concurrent_phase_log_threshold: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling setGCConcurrentPhaseLogThreshold(0) or any negative int; often from config parsing that permits 0 as a 'disabled' sentinel.

Common situations: Users set gc_concurrent_phase_log_threshold: 0 in cassandra.yaml expecting it to disable GC logging; the setter rejects it.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/7f084636f90cd563. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/config/DatabaseDescriptor.java:5062

            throw new IllegalArgumentException("Threshold must be less than Integer.MAX_VALUE");

        long gcLogThresholdInMs = getGCLogThreshold();
        if (threshold != 0 && threshold <= gcLogThresholdInMs)
            throw new IllegalArgumentException("Threshold value for gc_warn_threshold (" + threshold + ") must be greater than gc_log_threshold which is currently "
                                               + gcLogThresholdInMs);

        conf.gc_warn_threshold = new DurationSpec.IntMillisecondsBound(threshold);
    }

    public static int getGCConcurrentPhaseLogThreshold()
    {
        return conf.gc_concurrent_phase_log_threshold.toMilliseconds();
    }

    public static void setGCConcurrentPhaseLogThreshold(int threshold)
    {
        if (threshold <= 0)
            throw new IllegalArgumentException("Threshold must be greater than 0");

        long gcConcurrentPhaseWarnThresholdInMs = getGCConcurrentPhaseWarnThreshold();
        if (gcConcurrentPhaseWarnThresholdInMs != 0 && threshold > gcConcurrentPhaseWarnThresholdInMs)
            throw new IllegalArgumentException("Threshold value for gc_concurrent_phase_log_threshold (" + threshold + ") must be less than gc_concurrent_phase_warn_threshold which is currently "
                                               + gcConcurrentPhaseWarnThresholdInMs);

        conf.gc_concurrent_phase_log_threshold = new DurationSpec.IntMillisecondsBound(threshold);
    }

    public static int getGCConcurrentPhaseWarnThreshold()
    {
        return conf.gc_concurrent_phase_warn_threshold.toMilliseconds();
    }

    public static void setGCConcurrentPhaseWarnThreshold(int threshold)
    {
        if (threshold < 0)
            throw new IllegalArgumentException("Threshold value for gc_concurrent_phase_warn_threshold must be greater than or equal to 0");

View on GitHub (pinned to 88fd0f6a0e)