Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions pkg/worker/criu.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,37 @@ func (s *Worker) waitForSyncFile(request *types.ContainerRequest, outputLogger *
defer cancel()

syncFilePath := filepath.Join(s.config.Worker.CRIU.Storage.MountPath, fmt.Sprintf("%s.%s", request.Checkpoint.CheckpointId, syncFileExtension))
checkpointPath := s.checkpointPath(request.Checkpoint.CheckpointId)

// Check if sync file exists but checkpoint data is missing (cleaned up due to inactivity)
// If so, delete the sync file to force a re-sync from S3
if _, err := os.Stat(syncFilePath); err == nil {
if _, err := os.Stat(checkpointPath); os.IsNotExist(err) {
outputLogger.Info("Checkpoint data missing, forcing re-sync")
os.Remove(syncFilePath)
}
}

_, err := os.Stat(syncFilePath)
if err == nil {
return nil
// Check if both sync file and checkpoint data exist
if _, err := os.Stat(syncFilePath); err == nil {
if _, err := os.Stat(checkpointPath); err == nil {
return nil
}
}

outputLogger.Info("Waiting for checkpoint to sync")
for {
_, err := os.Stat(syncFilePath)
if err == nil {
syncFileExists := false
checkpointExists := false

if _, err := os.Stat(syncFilePath); err == nil {
syncFileExists = true
}
if _, err := os.Stat(checkpointPath); err == nil {
checkpointExists = true
}

if syncFileExists && checkpointExists {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/beta9/abstractions/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -3934,4 +3934,4 @@ async def list_urls(self) -> Dict[int, str]:
Raises:
SandboxConnectionError: If listing URLs fails.
"""
return await asyncio.to_thread(self._sync.list_urls)
return await asyncio.to_thread(self._sync.list_urls)
Loading