pinpoint-apm/pinpoint · error · java.lang.IllegalArgumentException
intervalMillis must be positive: ${intervalMillis}
Error message
intervalMillis must be positive: ${intervalMillis} What it means
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).
Source
Thrown at commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/logging/TimeLogThrottle.java:47
*
* @author Woonduk Kang(emeroad)
*/
public class TimeLogThrottle implements LogThrottle {
private static final AtomicLongFieldUpdater<TimeLogThrottle> NEXT_LOG_TIME
= AtomicLongFieldUpdater.newUpdater(TimeLogThrottle.class, "nextLogTime");
private volatile long nextLogTime;
private final long intervalMillis;
private final LongSupplier clock;
public TimeLogThrottle(long intervalMillis) {
this(intervalMillis, System::currentTimeMillis);
}
TimeLogThrottle(long intervalMillis, LongSupplier clock) {
if (intervalMillis <= 0) {
throw new IllegalArgumentException("intervalMillis must be positive: " + intervalMillis);
}
this.intervalMillis = intervalMillis;
this.clock = clock;
}
@Override
public boolean tryAcquire() {
final long now = clock.getAsLong();
final long next = this.nextLogTime;
if (now < next) {
return false;
}
// CAS makes a single winner per interval under concurrency
return NEXT_LOG_TIME.compareAndSet(this, next, now + intervalMillis);
}
@OverrideView on GitHub (pinned to 744c3d3075)
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)
Example fix
// before long interval = TimeUnit.SECONDS.toMillis(config.getIntervalSeconds()); // 0 when unset TimeLogThrottle throttle = new TimeLogThrottle(interval); // after long interval = Math.max(1, TimeUnit.SECONDS.toMillis(config.getIntervalSecondsOrDefault(1))); TimeLogThrottle throttle = new TimeLogThrottle(interval);
Defensive patterns
Strategy: validation
Validate before calling
static TimeLogThrottle create(long intervalMillis) {
if (intervalMillis <= 0) throw new IllegalArgumentException("configured interval must be > 0, got " + intervalMillis);
return new TimeLogThrottle(intervalMillis);
} Try / catch
try { throttle = new TimeLogThrottle(cfgInterval); } catch (IllegalArgumentException e) { throttle = new TimeLogThrottle(1000); } Prevention
- 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
When it happens
Trigger: new TimeLogThrottle(0) or new TimeLogThrottle(negative) — typically from a config value (log throttle interval) that defaulted to 0 or was mis-parsed.
Common situations: Property like profiler.log.throttle.interval unset, parsed to 0; unit confusion (seconds vs millis yielding 0 after integer division); copy-pasted negative value.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- negative cache size:${size}
- Unknown AgentType:
- Failed to detect pinpoint profile. Please add -Dpinpoint.act
- unsupported profile or profile alias:
- %s load fail Caused by:%s
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/ab7825d51f8ffd08.
Report an issue: GitHub.