Increase sandbox.waitForStopped timeout yet again.

For humongous containers (>256GiB of RAM), this can exceed 45s even on
beefy machines.

I considered making the timeout scale based on the memory usage of the
sandbox, but this is only an approximate proxy metric for time to shut down,
and I don't think we can reliably get it once the sandbox process is already
shutting down.

PiperOrigin-RevId: 624009617
This commit is contained in:
Etienne Perot
2024-04-11 19:05:25 -07:00
committed by gVisor bot
parent 0c50496d1a
commit 596e8d22b9
+4 -2
View File
@@ -1451,7 +1451,10 @@ func (s *Sandbox) destroyContainer(cid string) error {
return nil
}
// waitForStopped waits for the sandbox to actually stop.
// This should only be called when the sandbox is known to be shutting down.
func (s *Sandbox) waitForStopped() error {
const waitTimeout = 2 * time.Minute
if s.child {
s.statusMu.Lock()
defer s.statusMu.Unlock()
@@ -1467,8 +1470,7 @@ func (s *Sandbox) waitForStopped() error {
s.Pid.store(0)
return nil
}
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), waitTimeout)
defer cancel()
b := backoff.WithContext(backoff.NewConstantBackOff(100*time.Millisecond), ctx)
op := func() error {