@@ -26,12 +26,14 @@ import (
2626var errRuntimeNotReady = errors .New ("runtime is not yet ready" )
2727
2828const (
29- runtimeInitTimeout = 1 * time .Second
30- runtimeExtendedInitTimeout = 120 * time .Second
31- runtimeInterruptTimeout = 1 * time .Second
29+ runtimeInitTimeout = time .Second
30+ runtimeExtendedInitTimeout = 2 * time .Minute
31+ runtimeInterruptTimeout = time .Second
3232 stopTickerTimeout = 15 * time .Minute
3333 watchdogInterval = 15 * time .Second
3434 watchdogPingTimeout = 5 * time .Second
35+ restartMaxInterval = time .Hour
36+ restartMaxElapsedTime = 24 * time .Hour
3537
3638 ctrlChannelBufferSize = 16
3739)
@@ -473,7 +475,10 @@ func (h *sandboxHost) manager(ctx context.Context) {
473475 // Initialize a ticker for restarting the process. We use a separate channel
474476 // to restart the process immediately on the first run, as we don't want to wait
475477 // for the first tick.
476- ticker = backoff .NewTicker (cmnBackoff .NewExponentialBackOff ())
478+ ticker = backoff .NewTicker (backoff .NewExponentialBackOff (
479+ backoff .WithMaxInterval (restartMaxInterval ),
480+ backoff .WithMaxElapsedTime (restartMaxElapsedTime ),
481+ ))
477482 firstTickCh <- struct {}{}
478483 attempt = 0
479484 }
@@ -483,7 +488,11 @@ func (h *sandboxHost) manager(ctx context.Context) {
483488 h .logger .Warn ("termination requested" )
484489 return
485490 case <- firstTickCh :
486- case <- ticker .C :
491+ case _ , ok := <- ticker .C :
492+ if ! ok {
493+ h .logger .Warn ("restart ticker stopped" )
494+ return
495+ }
487496 }
488497
489498 attempt ++
@@ -494,6 +503,7 @@ func (h *sandboxHost) manager(ctx context.Context) {
494503 if err := h .startProcess (ctx ); err != nil {
495504 h .logger .Error ("failed to start runtime" ,
496505 "err" , err ,
506+ "attempt" , attempt ,
497507 )
498508
499509 // Notify subscribers that a runtime has failed to start.
0 commit comments