{"record":{"id":"ab7825d51f8ffd08","repo":"pinpoint-apm/pinpoint","slug":"intervalmillis-must-be-positive-intervalmillis","errorCode":null,"errorMessage":"intervalMillis must be positive: ${intervalMillis}","messagePattern":"intervalMillis must be positive: (.+?)","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/logging/TimeLogThrottle.java","lineNumber":47,"sourceCode":" *\n * @author Woonduk Kang(emeroad)\n */\npublic class TimeLogThrottle implements LogThrottle {\n    private static final AtomicLongFieldUpdater<TimeLogThrottle> NEXT_LOG_TIME\n            = AtomicLongFieldUpdater.newUpdater(TimeLogThrottle.class, \"nextLogTime\");\n\n    private volatile long nextLogTime;\n\n    private final long intervalMillis;\n    private final LongSupplier clock;\n\n    public TimeLogThrottle(long intervalMillis) {\n        this(intervalMillis, System::currentTimeMillis);\n    }\n\n    TimeLogThrottle(long intervalMillis, LongSupplier clock) {\n        if (intervalMillis <= 0) {\n            throw new IllegalArgumentException(\"intervalMillis must be positive: \" + intervalMillis);\n        }\n        this.intervalMillis = intervalMillis;\n        this.clock = clock;\n    }\n\n    @Override\n    public boolean tryAcquire() {\n\n        final long now = clock.getAsLong();\n        final long next = this.nextLogTime;\n        if (now < next) {\n            return false;\n        }\n        // CAS makes a single winner per interval under concurrency\n        return NEXT_LOG_TIME.compareAndSet(this, next, now + intervalMillis);\n    }\n\n    @Override","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/logging/TimeLogThrottle.java#L29-L65","documentation":"TimeLogThrottle's package-private constructor validates that intervalMillis is strictly positive and throws IllegalArgumentException with the offending value embedded in the message. A non-positive interval would make throttling meaningless (log suppressed or spammed every call).","triggerScenarios":"new TimeLogThrottle(0) or new TimeLogThrottle(negative) — typically from a config value (log throttle interval) that defaulted to 0 or was mis-parsed.","commonSituations":"Property like profiler.log.throttle.interval unset, parsed to 0; unit confusion (seconds vs millis yielding 0 after integer division); copy-pasted negative value.","solutions":["Pass a positive interval, e.g. TimeLogThrottle(1000) for 1-second throttling","Add a config default/validation at the call site: max(1, configuredMillis)","Fix the parse that yields 0 (missing property, wrong unit, integer division truncation)"],"exampleFix":"// before\nlong interval = TimeUnit.SECONDS.toMillis(config.getIntervalSeconds()); // 0 when unset\nTimeLogThrottle throttle = new TimeLogThrottle(interval);\n// after\nlong interval = Math.max(1, TimeUnit.SECONDS.toMillis(config.getIntervalSecondsOrDefault(1)));\nTimeLogThrottle throttle = new TimeLogThrottle(interval);","handlingStrategy":"validation","validationCode":"static TimeLogThrottle create(long intervalMillis) {\n    if (intervalMillis <= 0) throw new IllegalArgumentException(\"configured interval must be > 0, got \" + intervalMillis);\n    return new TimeLogThrottle(intervalMillis);\n}","typeGuard":null,"tryCatchPattern":"try { throttle = new TimeLogThrottle(cfgInterval); } catch (IllegalArgumentException e) { throttle = new TimeLogThrottle(1000); }","preventionTips":["Validate the interval config at startup with a positive default","Watch for integer division / unit conversion producing 0","Fail fast on bad config rather than falling back silently in production"],"tags":["java","logging","illegal-argument","configuration"],"backgroundTag":"invalid-argument-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}