Skip to content

agent: first registrar watch-stream attempt logs ERROR 'context canceled' on a clean startup, then retries fine #700

Closed

Description

@bpalermo

Observation

A freshly started agent logs, at ERROR level, 0.6s after resolved workload trust domain from SPIRE:

14:15:30.929Z ERROR registrar/registrar.go:463 failed to start watch stream, retrying
              rpc error: code = Canceled desc = context canceled

then retries and recovers with no further errors; the pod is Ready 10s later, restartCount 0. Seen on aether-agent-9qjms (main-worker-03, rev194) during the #662 pressure test, i.e. while the collector was shedding — but the registrar watch has nothing to do with the collector, so the cancelled context is most likely a startup-ordering artifact (a bounded initial-dial context replaced by the manager's context, or the watch goroutine starting before the manager's context is the one it should use).

Why it matters

  1. It is the only ERROR in a healthy startup, so any "no ERROR lines" gate (the pressure harness, soak validators, the #666 check) trips on it.
  2. If the first watch attempt is systematically cancelled, every agent start pays one extra reconnect on the registrar stream — cheap, but build(deps): bump google.golang.org/grpc to v1.83.0 (security) #612's reconnect-doubling history says these add up under concurrency.

Ask

Find which context reaches the first watch stream attempt at registrar.go:463 and why it is already cancelled; either use the right context or log the first attempt's cancellation at WARN with a "startup" marker so it is distinguishable from a real stream failure. A unit test that starts the registrar client under a live manager context and asserts zero ERROR-level lines on a clean start.

Low priority; filed so it is not rediscovered. Refs #662, #612.

Activity

  1. bpalermo commented on Sep 5, 2026

    @bpalermo
    OwnerAuthor

    Validated on talos-main after the #712 merge (helm rev199, chart 0.92.5, appVersion 3093d6b, 21:01–21:06Z 2026-09-05): on all five nodes the fresh agent log has 0 ERROR lines from the startup path and exactly the new INFO line watch stream superseded by a service-filter change before it connected; reconnecting startup=true (w01 twice — two filter changes before connect). The old failed to start watch stream, retrying ERROR is gone on every node. For contrast, the pre-fix agent restarted by the #699 pressure run 12 minutes earlier still logged it. One unrelated ERROR remains on w04: registrar/registrar.go:588 watch stream disconnected … GOAWAY at 21:02:27Z, which is the registrar Deployment rolling under it during the same upgrade — a genuine mid-life disconnect that reconnected; arguably WARN-worthy when the server sent GOAWAY, but not this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions