1
0
mirror of https://github.com/prometheus/alertmanager.git synced 2026-10-24 20:39:28 +03:00
Files
alertmanager/httpserver/httpserver.go
June Kim 1193873419 httpserver: make /-/reload handler cancellation-safe
Fix three bugs in the reload handler identified in #5103:

1. Use a buffered error channel (size 1) so the reloader goroutine
   never blocks if the HTTP client disconnects before reading the
   result.

2. Remove the incorrect `defer close(errc)` — the handler is the
   receiver, not the sender; closing from the receiver side could
   panic the sender.

3. Wrap both the enqueue (send to reloadCh) and the reply (receive
   from errc) in select statements that also listen on
   req.Context().Done(), so a client disconnect unblocks the handler
   at either stage.

Fixes #5103

Signed-off-by: June Kim <kimjune01@gmail.com>
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
2026-08-19 11:59:49 +02:00

2.4 KiB