ha: keep held-leg cancellation first when a lost lease stops
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
1 file changed,
+4
−4
internal/activator/activator.go+4 −4
diff --git a/internal/activator/activator.go b/internal/activator/activator.go| index 6fb5bafdf..dd42def7f 100644 |
| --- a/internal/activator/activator.go |
| +++ b/internal/activator/activator.go |
| @@ -3390,14 +3390,14 @@ const actStopTimeout = 20 * time.Second |
| // why (the Stop* reasons in cmd.go): a run the stop interrupts tells the |
| // member (run spec §5.3). |
| func (a *Service) beginStopLocked(e *actEntry, why string) { |
| - if why == StopLeaseLost || (e.state == actAwake && servingError(e) != nil) { |
| - a.latchHALossLocked(e) |
| - } |
| - |
| // Held legs end with the stop, in this critical section, before the |
| // stop goroutine starts (edge-held streams spec §3.2): a leg is either |
| // registered now and cancelled here, or admitted later and refused. |
| a.cancelHeldLegsLocked(e, 0) |
| + if why == StopLeaseLost || (e.state == actAwake && servingError(e) != nil) { |
| + a.latchHALossLocked(e) |
| + } |
| + |
| // A hold canary's settle ends with an intentional stop, before anything |
| // is stopped (zero-downtime spec §6.4). A process that already exited |
| // died of its build, and its stop must not hide that. |