Skip to content

Commit 4b62c59

Browse files
committed
fixup! fix(orchestrator): enforce sandbox TTL on the node via WaitForExit
1 parent 1921bad commit 4b62c59

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/orchestrator/pkg/sandbox/sandbox.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,8 @@ func (s *Sandbox) WaitForExit(ctx context.Context) error {
17211721
defer span.End()
17221722

17231723
for {
1724-
timeout := time.Until(s.GetEndAt())
1724+
endAt := s.GetEndAt()
1725+
timeout := time.Until(endAt)
17251726
if timeout <= 0 {
17261727
return errors.New("sandbox TTL expired")
17271728
}
@@ -1730,7 +1731,7 @@ func (s *Sandbox) WaitForExit(ctx context.Context) error {
17301731
select {
17311732
case <-timer.C:
17321733
// Re-check in case SetEndAt extended the deadline (e.g. via KeepAlive).
1733-
if time.Until(s.GetEndAt()) > 0 {
1734+
if s.GetEndAt().After(endAt) {
17341735
continue
17351736
}
17361737
return errors.New("waiting for exit took too long")

packages/orchestrator/pkg/server/sandboxes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ func (s *Server) setupSandboxLifecycle(ctx context.Context, sbx *sandbox.Sandbox
10431043

10441044
waitErr := sbx.WaitForExit(ctx)
10451045
if waitErr != nil {
1046-
sbxlogger.I(sbx).Error(ctx, "sandbox TTL expired, stopping", zap.Error(waitErr))
1046+
sbxlogger.I(sbx).Error(ctx, "sandbox exit wait failed, stopping", zap.Error(waitErr))
10471047
if stopErr := sbx.Stop(ctx); stopErr != nil {
10481048
sbxlogger.I(sbx).Error(ctx, "failed to stop timed-out sandbox", zap.Error(stopErr))
10491049
}

0 commit comments

Comments
 (0)