Repository navigation
Description
Summary
On a multi-replica deployment, every non-leader replica logs at INFO on every
lease-acquire attempt, forever. With mecak8s at 2 replicas this is roughly one line
every 2 seconds for the life of the pod, which buries everything else in the log.
internal/adapter/scheduler/scheduler.go:607:
default:
// ErrLeaseHeld (a peer leads) or a transient infra fault: standby.
if errors.Is(err, port.ErrLeaseHeld) {
s.diag.Log(ctx, port.LevelInfo, "another replica is the scheduler leader; standing by",
"owner", s.cfg.LeaseOwner)
}
...
if !s.sleepOrDone(ctx, jitteredBackoff()) {The loop is correct — jittered backoff exists precisely to avoid a thundering herd on
the lease backend. The problem is only that the log fires per attempt rather than
per state change.
Observed
Real output from the fixture's standby replica:
time=2026-08-27T08:16:44.713Z level=INFO msg="another replica is the scheduler leader; standing by" component=scheduler owner=mecak8s-...-qhdwg-1-fcf3deb58ca1cd05
time=2026-08-27T08:16:46.863Z level=INFO msg="another replica is the scheduler leader; standing by" component=scheduler owner=mecak8s-...-qhdwg-1-fcf3deb58ca1cd05
time=2026-08-27T08:16:48.831Z level=INFO msg="another replica is the scheduler leader; standing by" component=scheduler owner=mecak8s-...-qhdwg-1-fcf3deb58ca1cd05
time=2026-08-27T08:16:51.457Z level=INFO msg="another replica is the scheduler leader; standing by" component=scheduler owner=mecak8s-...-qhdwg-1-fcf3deb58ca1cd05
Impact
This is not cosmetic. Diagnosing an unrelated session problem on that deployment
required filtering the line out before anything else was visible; two successive
kubectl logs | grep passes over a 20-minute window returned nothing at all
because the surrounding lines had scrolled past the tail. It also inflates log
volume and cost for any deployment shipping INFO to a log backend, in proportion
to replica count and uptime.
Suggested fix
Log the transition, not the attempt: emit once when the replica enters standby and
once when it leaves (acquires, or the error class changes), and drop it to DEBUG for
the per-attempt case. The ErrLeaseHeld branch is a steady state, not an event.
The sibling LevelWarn branch a few lines below (a transient acquire failure) has
the same shape and is arguably worse, since a persistent infra fault would emit a
WARN per backoff. Sticky-once, in the style of Engine.save's
Run.saveWarned, would fit both.
Notes
Found while diagnosing the mecak8s vMCP Kind fixture, but it is not
fixture-specific: it affects any multi-replica deployment with a leasing scheduler
backend. Single-replica deployments never hit it, since they acquire the lease.
Activity
fix: reduce scheduler standby log noise
fix: reduce scheduler standby log noise