{"record":{"id":"638b6fd53e641b58","repo":"pinpoint-apm/pinpoint","slug":"illegal-report-period","errorCode":null,"errorMessage":"Illegal report period: ","messagePattern":"Illegal report period: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/sender/grpc/metric/DefaultChannelzScheduledReporter.java","lineNumber":32,"sourceCode":"import java.util.concurrent.ThreadFactory;\nimport java.util.concurrent.TimeUnit;\n\npublic class DefaultChannelzScheduledReporter implements ChannelzScheduledReporter {\n\n    private static final long REPORT_INITIAL_DELAY_MS = 1000;\n\n    private final Logger logger = LogManager.getLogger(this.getClass());\n\n    private final ConcurrentMap<Long, ChannelzReporter> reporterMap = new ConcurrentHashMap<>();\n    private final ScheduledExecutorService scheduledExecutorService = newScheduledExecutorService();\n\n    private final long reportPeriodMillis;\n\n    public DefaultChannelzScheduledReporter(Duration reportPeriod) {\n        Objects.requireNonNull(reportPeriod, \"reportPeriod\");\n        this.reportPeriodMillis = reportPeriod.toMillis();\n        if (this.reportPeriodMillis <= 0) {\n            throw new IllegalArgumentException(\"Illegal report period: \" + reportPeriod);\n        }\n    }\n    private static ScheduledExecutorService newScheduledExecutorService() {\n        String threadName = PinpointThreadFactory.DEFAULT_THREAD_NAME_PREFIX +\n                DefaultChannelzScheduledReporter.class.getSimpleName();\n        ThreadFactory threadFactory = new PinpointThreadFactory(threadName, true);\n        return new ScheduledThreadPoolExecutor(1, threadFactory);\n    }\n\n    @Override\n    public void registerRootChannel(final long id, final ChannelzReporter reporter) {\n        Objects.requireNonNull(reporter, \"reporter\");\n\n        final ChannelzReporter old = reporterMap.putIfAbsent(id, reporter);\n        if (old != null) {\n            return;\n        }\n        scheduledExecutorService.scheduleAtFixedRate(new Runnable() {","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/sender/grpc/metric/DefaultChannelzScheduledReporter.java#L14-L50","documentation":"DefaultChannelzScheduledReporter schedules gRPC channelz metrics reporting at a fixed period; the constructor converts the Duration to millis and rejects non-positive values with IllegalArgumentException. A non-positive period cannot be scheduled and indicates a configuration error.","triggerScenarios":"Constructing new DefaultChannelzScheduledReporter(Duration.ZERO), a negative Duration, or a duration resolving to <= 0 millis from config (e.g. profiler.channelz.period=0).","commonSituations":"Config placeholder defaulting to 0, user setting 0 intending to disable channelz reporting (should disable the feature instead), or a unit-conversion bug producing a sub-millisecond duration.","solutions":["Set the report period config to a positive duration (e.g. 60s)","Disable channelz reporting via its feature flag instead of a zero period","Check duration parsing/unit configuration so the value is not truncated to 0"],"exampleFix":"// before\nprofiler.channelz.report.period=0\n// after\nprofiler.channelz.report.period=60s","handlingStrategy":"validation","validationCode":"Duration d = Duration.parse(props.getProperty(\"profiler.channelz.report.period\"));\nif (d.isZero() || d.isNegative()) throw new IllegalArgumentException(\"channelz report period must be positive, got \" + d);","typeGuard":"boolean isValidReportPeriod(Duration d) { return d != null && !d.isZero() && !d.isNegative(); }","tryCatchPattern":"try { reporter = new DefaultChannelzScheduledReporter(period); } catch (IllegalArgumentException e) { log.error(\"Bad channelz report period: {}\", e.getMessage()); }","preventionTips":["Configure positive durations with explicit time units (e.g. 60s)","Disable channelz via its feature flag rather than a zero period","Validate duration parsing to catch unit mistakes that truncate to 0"],"tags":["java","grpc","configuration"],"backgroundTag":"argument-out-of-range","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"}