Skip to content

Commit

Permalink
Add logging and temporary force update of container status (#744)
Browse files Browse the repository at this point in the history
Adds some logs around potential causes of the PENDING container bug.
Also, adds a forced update to the container status for now to make sure
it at least gets cleaned up.
  • Loading branch information
dleviminzi authored Nov 27, 2024
1 parent 2318d06 commit 91eabf5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/worker/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,12 @@ func (s *Worker) spawn(request *types.ContainerRequest, spec *specs.Spec, output
}
}

log.Printf("<%s> - updating container status to running\n", containerId)
// Update container status to running
s.containerRepo.UpdateContainerStatus(containerId, types.ContainerStatusRunning, time.Duration(types.ContainerStateTtlS)*time.Second)
err := s.containerRepo.UpdateContainerStatus(containerId, types.ContainerStatusRunning, time.Duration(types.ContainerStateTtlS)*time.Second)
if err != nil {
log.Printf("<%s> failed to update container status to running: %v", containerId, err)
}
}()

// Setup container overlay filesystem
Expand Down
6 changes: 6 additions & 0 deletions pkg/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ func (s *Worker) updateContainerStatus(request *types.ContainerRequest) error {

log.Printf("<%s> - container still running: %s\n", request.ContainerId, request.ImageId)

// TODO: remove this hotfix
if state.Status == types.ContainerStatusPending {
log.Printf("<%s> - forcing container status to running\n", request.ContainerId)
state.Status = types.ContainerStatusRunning
}

err = s.containerRepo.UpdateContainerStatus(request.ContainerId, state.Status, time.Duration(types.ContainerStateTtlS)*time.Second)
if err != nil {
log.Printf("<%s> - unable to update container state: %v\n", request.ContainerId, err)
Expand Down

0 comments on commit 91eabf5

Please sign in to comment.