Summary
ServeHTTP holds servicesMtx.RLock across service matching, authentication, external store/pricer calls, and the full reverse-proxy response. UpdateServices needs the write lock.
A hung backend request or long-lived gRPC/streaming response can therefore prevent configuration updates indefinitely.
Impact
One request can block operational changes such as updating a backend, changing authentication policy, or deploying an emergency configuration. This is especially problematic for services intended to maintain long-lived streams.
Proposed direction
Publish immutable service/backend generations:
- Acquire the read lock only long enough to capture the current generation.
- Release it before authentication and backend I/O.
- Track generation references while requests use it.
- Retire and clean up old generation resources after their references drain.
This should be coordinated with transport/pricer retirement so shortening the lock does not close resources still used by requests or metering reports.
Acceptance criteria
- A long-lived request on generation A does not prevent publishing generation B.
- The request continues safely on generation A.
- New requests use generation B immediately after publication.
- Retired resources are eventually reclaimed without races.
Summary
ServeHTTPholdsservicesMtx.RLockacross service matching, authentication, external store/pricer calls, and the full reverse-proxy response.UpdateServicesneeds the write lock.A hung backend request or long-lived gRPC/streaming response can therefore prevent configuration updates indefinitely.
Impact
One request can block operational changes such as updating a backend, changing authentication policy, or deploying an emergency configuration. This is especially problematic for services intended to maintain long-lived streams.
Proposed direction
Publish immutable service/backend generations:
This should be coordinated with transport/pricer retirement so shortening the lock does not close resources still used by requests or metering reports.
Acceptance criteria