Skip to content

fix(arke): plug goroutine leaks and propagate TLS config errors in Serve#82

Open
miotte wants to merge 3 commits into
mainfrom
miotte-pr1
Open

fix(arke): plug goroutine leaks and propagate TLS config errors in Serve#82
miotte wants to merge 3 commits into
mainfrom
miotte-pr1

Conversation

@miotte
Copy link
Copy Markdown
Contributor

@miotte miotte commented May 18, 2026

Fixes #88

  • listener() now surfaces tlsConfig errors instead of silently falling back to cleartext when the operator asked for TLS.
  • serveErrChan is buffered and the non-OpError branch returns, removing the double-send / blocked-sender goroutine leak on shutdown.
  • Signal-handler goroutine now exits on context cancel and signal.Notify is stopped, preventing leaks across repeated Serve calls.

- listener() now surfaces tlsConfig errors instead of silently falling
  back to cleartext when the operator asked for TLS.
- serveErrChan is buffered and the non-OpError branch returns, removing
  the double-send / blocked-sender goroutine leak on shutdown.
- Signal-handler goroutine now exits on context cancel and
  signal.Notify is stopped, preventing leaks across repeated Serve calls.

Signed-off-by: Michael Otteni <MichaelGOtteni@gmail.com>
@miotte miotte marked this pull request as draft May 18, 2026 23:13
Adds tests for the previously-uncovered code paths in pkg/arke that
were pushing CI coverage to 79.6% (below the 80% threshold):

- WithPrometheus interceptor wiring
- WithRateLimit: nil, invalid params (zero bucket / refill / max age),
  and the valid path that installs the limiter and selector interceptors
- tlsConfig success path (loads a real keypair, asserts NextProtos)
- listener with TLS enabled and listener tlsConfig-error propagation
- Serve with the ratelimiter goroutine active
- Serve listener-error return path (bad cert path)

Local coverage for pkg/arke rises from 75.4% to 92.3%.

Signed-off-by: Michael Otteni <MichaelGOtteni@gmail.com>
@miotte miotte marked this pull request as ready for review May 18, 2026 23:19
The std-error-handling exclusion preset in golangci-config already
silences errcheck for Close() calls, so the nolint directive was
unused and tripped nolintlint.

Signed-off-by: Michael Otteni <MichaelGOtteni@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Goroutine leaks and silent TLS config fallback in arke Serve

1 participant