Skip to content

Shutdown cleanup has no timeout and can hang on an unreachable telemetry collector #504

Description

@retr0h

Cleanup callbacks pass context.Background() to calls that can block on the network: cmd/controller_start.go:96,99, cmd/agent_start.go:84,87, cmd/nats_server_start.go:80, cmd/start.go:185,188. metricsServer.Stop passes the context to meterProvider.Shutdown, and the tracer shutdown flushes an OTLP gRPC exporter when tracing uses otlp. The 10s budget in internal/cli/lifecycle.go:44-51 only wraps server.Stop, not these callbacks.

Impact: with the collector unreachable, SIGTERM may not terminate the process.

Fix: give cleanup a bounded context.WithTimeout.


Found in the September 2026 codebase review. Tracked in the review tracking issue.

Activity

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

    bugSomething isn't workingkind/go

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions