{"record":{"id":"90143eca2cd82377","repo":"apache/druid","slug":"watchseconds-s-must-be-at-least-1-second-to-avo","errorCode":null,"errorMessage":"watchSeconds [%s] must be at least 1 second to avoid non-blocking query loops","messagePattern":"watchSeconds \\[(.+?)\\] must be at least 1 second to avoid non-blocking query loops","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java","lineNumber":707,"sourceCode":"    private static final long DEFAULT_CIRCUIT_BREAKER_SLEEP_MS = 120_000; // 2 minutes\n\n    private final Duration watchSeconds;\n    private final long maxWatchRetries;\n    private final Duration watchRetryDelay;\n    private final Duration circuitBreakerSleep;\n\n    @JsonCreator\n    public WatchConfig(\n        @JsonProperty(\"watchSeconds\") @Nullable Duration watchSeconds,\n        @JsonProperty(\"maxWatchRetries\") @Nullable Long maxWatchRetries,\n        @JsonProperty(\"watchRetryDelay\") @Nullable Duration watchRetryDelay,\n        @JsonProperty(\"circuitBreakerSleep\") @Nullable Duration circuitBreakerSleep\n    )\n    {\n      this.watchSeconds = validatePositive(watchSeconds, DEFAULT_WATCH_TIMEOUT_MS, \"watchSeconds\");\n      // Consul blocking queries use seconds; sub-second values truncate to 0 causing tight loops\n      if (this.watchSeconds.getStandardSeconds() < 1) {\n        throw new IAE(\n            StringUtils.format(\n                \"watchSeconds [%s] must be at least 1 second to avoid non-blocking query loops\",\n                this.watchSeconds\n            )\n        );\n      }\n      this.maxWatchRetries = (maxWatchRetries == null || maxWatchRetries <= 0) ? Long.MAX_VALUE : maxWatchRetries;\n      this.watchRetryDelay = validateNonNegative(watchRetryDelay, DEFAULT_WATCH_RETRY_DELAY_MS, \"watchRetryDelay\");\n      this.circuitBreakerSleep = validatePositive(circuitBreakerSleep, DEFAULT_CIRCUIT_BREAKER_SLEEP_MS, \"circuitBreakerSleep\");\n    }\n\n    @JsonProperty\n    public Duration getWatchSeconds()\n    {\n      return watchSeconds;\n    }\n\n    @JsonProperty","sourceCodeStart":689,"sourceCodeEnd":725,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java#L689-L725","documentation":"WatchConfig validation: watchSeconds must be at least 1 second; a zero-second watch degenerates into a tight non-blocking polling loop against the Consul API, so such values are rejected when the config is created.","triggerScenarios":"Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java:707 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set watch.watchSeconds to at least 1 second (typical blocking-query values are 30-300s).","Remove the property to use the default watch duration."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}