apache/cassandra · error · IllegalArgumentException

Threshold value for gc_log*_threshold must be less than Inte

Error message

Threshold value for gc_log*_threshold must be less than Integer.MAX_VALUE

What it means

Cassandra throws this IllegalArgumentException from validateGCParams when the GC log threshold exceeds Integer.MAX_VALUE milliseconds. Thresholds are stored as int millisecond bounds, so values above the int range cannot be represented.

Source

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

    }

    public static long getGCLogThreshold()
    {
        return conf.gc_log_threshold.toMilliseconds();
    }

    public static void setGCLogThreshold(int threshold)
    {
        validateGCParams(threshold, getGCWarnThreshold());
        conf.gc_log_threshold = new DurationSpec.IntMillisecondsBound(threshold);
    }

    public static void validateGCParams(long logThreshold, long warnThreshold)
    {
        if (logThreshold <= 0)
            throw new IllegalArgumentException("Threshold value for gc_log*_threshold must be greater than 0");
        if (logThreshold > Integer.MAX_VALUE)
            throw new IllegalArgumentException("Threshold value for gc_log*_threshold must be less than Integer.MAX_VALUE");

        if (warnThreshold <= 0)
            throw new IllegalArgumentException("Threshold value for gc_warn*_threshold must be greater than 0");
        if (warnThreshold > Integer.MAX_VALUE)
            throw new IllegalArgumentException("Threshold value for gc_warn*_threshold must be less than Integer.MAX_VALUE");

        if (warnThreshold != 0 && logThreshold > warnThreshold)
            throw new IllegalArgumentException("Threshold value for gc_log*_threshold (" + logThreshold + ") must be less than gc_warn*_threshold which is currently "
                    + warnThreshold);
    }

    public static EncryptionContext getEncryptionContext()
    {
        return encryptionContext;

    }

    public static long getGCWarnThreshold()

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set gc_log_threshold below Integer.MAX_VALUE ms (~24.8 days)
  2. Verify the unit suffix in cassandra.yaml (e.g. 200ms, not 200000000000ns)
  3. Clamp or validate long values before calling validateGCParams

Example fix

// before
validateGCParams(5_000_000_000L, 10_000_000_000L);
// after
validateGCParams(200L, 1000L);
Defensive patterns

Strategy: validation

Validate before calling

if (logThreshold > Integer.MAX_VALUE)
    logThreshold = Integer.MAX_VALUE; // or reject

Try / catch

try {
    DatabaseDescriptor.validateGCParams(logThreshold, warnThreshold);
} catch (IllegalArgumentException e) {
    logger.error("gc_log_threshold out of int range", e);
}

Prevention

When it happens

Trigger: Calling validateGCParams with logThreshold > 2147483647, typically from a misconfigured gc_log_threshold in cassandra.yaml (e.g. value given in a unit that resolves to billions of ms) or a programmatic call passing Long values.

Common situations: Unit confusion (nanoseconds/microseconds pasted into a ms field) or computing the threshold from a formula without clamping.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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