apache/druid · warning

watchSeconds (%ds) is much larger than leaderSessionTtl (%ds

Error message

watchSeconds (%ds) is much larger than leaderSessionTtl (%ds): delayed failure detection possible

What it means

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.

Source

Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java:144

              watch.getWatchSeconds()
          )
      );
    }

    long serviceTtlSeconds = Math.max(30, service.getHealthCheckInterval().getStandardSeconds() * 3);
    if (service.getDeregisterAfter().getStandardSeconds() < serviceTtlSeconds) {
      throw new IAE(
          StringUtils.format(
              "deregisterAfter (%ds) must be >= service TTL (%ds = 3 × healthCheckInterval)",
              service.getDeregisterAfter().getStandardSeconds(),
              serviceTtlSeconds
          )
      );
    }

    // Large watchSeconds relative to session TTL can delay failure detection
    if (watch.getWatchSeconds().getStandardSeconds() > leader.getLeaderSessionTtl().getStandardSeconds() * 2) {
      LOGGER.warn(
          "watchSeconds (%ds) is much larger than leaderSessionTtl (%ds): delayed failure detection possible",
          watch.getWatchSeconds().getStandardSeconds(),
          leader.getLeaderSessionTtl().getStandardSeconds()
      );
    }
  }

  public ConnectionConfig getConnection()
  {
    return connection;
  }

  public AuthConfig getAuth()
  {
    return auth;
  }

  public ServiceConfig getService()

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Lower watchSeconds so it is at most twice leaderSessionTtl (ideally near the TTL itself).
  2. Alternatively increase leaderSessionTtl if the intent is longer tolerated leader absence, then re-check the ratio.
  3. Ignore the warning only if delayed failure detection is acceptable in your environment.

Example fix

// before
watch.setWatchSeconds(60);
leader.setLeaderSessionTtl(15);
// after
watch.setWatchSeconds(15); // <= 2 * leaderSessionTtl
leader.setLeaderSessionTtl(15);
Defensive patterns

Strategy: validation

Validate before calling

long watchSeconds = cfg.getWatch().getWatchSeconds().getStandardSeconds();
long ttl = cfg.getLeader().getLeaderSessionTtl().getStandardSeconds();
if (watchSeconds > ttl * 2) {
  throw new IllegalArgumentException("watchSeconds must be <= 2 * leaderSessionTtl");
}

Prevention

When it happens

Trigger: Building ConsulDiscoveryConfig where watch.watchSeconds > 2 * leader.leaderSessionTtl, e.g. watchSeconds=60 with leaderSessionTtl=15.

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/3a86f08a4c3b91ec. Report an issue: GitHub.