{"record":{"id":"3a86f08a4c3b91ec","repo":"apache/druid","slug":"watchseconds-ds-is-much-larger-than-leadersessi","errorCode":null,"errorMessage":"watchSeconds (%ds) is much larger than leaderSessionTtl (%ds): delayed failure detection possible","messagePattern":"watchSeconds \\((.+?)s\\) is much larger than leaderSessionTtl \\((.+?)s\\): delayed failure detection possible","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java","lineNumber":144,"sourceCode":"              watch.getWatchSeconds()\n          )\n      );\n    }\n\n    long serviceTtlSeconds = Math.max(30, service.getHealthCheckInterval().getStandardSeconds() * 3);\n    if (service.getDeregisterAfter().getStandardSeconds() < serviceTtlSeconds) {\n      throw new IAE(\n          StringUtils.format(\n              \"deregisterAfter (%ds) must be >= service TTL (%ds = 3 × healthCheckInterval)\",\n              service.getDeregisterAfter().getStandardSeconds(),\n              serviceTtlSeconds\n          )\n      );\n    }\n\n    // Large watchSeconds relative to session TTL can delay failure detection\n    if (watch.getWatchSeconds().getStandardSeconds() > leader.getLeaderSessionTtl().getStandardSeconds() * 2) {\n      LOGGER.warn(\n          \"watchSeconds (%ds) is much larger than leaderSessionTtl (%ds): delayed failure detection possible\",\n          watch.getWatchSeconds().getStandardSeconds(),\n          leader.getLeaderSessionTtl().getStandardSeconds()\n      );\n    }\n  }\n\n  public ConnectionConfig getConnection()\n  {\n    return connection;\n  }\n\n  public AuthConfig getAuth()\n  {\n    return auth;\n  }\n\n  public ServiceConfig getService()","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java#L126-L162","documentation":"A configuration-consistency warning from ConsulDiscoveryConfig.validateCrossFieldConstraints, run at config construction. It fires when the Consul watch blocking-query duration (watchSeconds) is more than twice the leader session TTL (leaderSessionTtl). A long watch delays noticing that the leader session expired, so failover/failure detection can be much slower than the TTL implies.","triggerScenarios":"Building ConsulDiscoveryConfig where watch.watchSeconds > 2 * leader.leaderSessionTtl, e.g. watchSeconds=60 with leaderSessionTtl=15.","commonSituations":"Operators tuning long blocking queries to reduce request load without realizing it also delays leader-failure detection; copying TTL defaults from docs while separately increasing watch timeout.","solutions":["Lower watchSeconds so it is at most twice leaderSessionTtl (ideally near the TTL itself).","Alternatively increase leaderSessionTtl if the intent is longer tolerated leader absence, then re-check the ratio.","Ignore the warning only if delayed failure detection is acceptable in your environment."],"exampleFix":"// before\nwatch.setWatchSeconds(60);\nleader.setLeaderSessionTtl(15);\n// after\nwatch.setWatchSeconds(15); // <= 2 * leaderSessionTtl\nleader.setLeaderSessionTtl(15);","handlingStrategy":"validation","validationCode":"long watchSeconds = cfg.getWatch().getWatchSeconds().getStandardSeconds();\nlong ttl = cfg.getLeader().getLeaderSessionTtl().getStandardSeconds();\nif (watchSeconds > ttl * 2) {\n  throw new IllegalArgumentException(\"watchSeconds must be <= 2 * leaderSessionTtl\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep watchSeconds close to leaderSessionTtl","Validate config ratios in CI before deployment","Document the failure-detection tradeoff when tuning watch durations"],"tags":["consul","configuration","leader-election","failover"],"backgroundTag":"invalid-config-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}