Skip to content
Open
Changes from 3 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
7 changes: 4 additions & 3 deletions packages/orchestrator/internal/sandbox/uffd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"syscall"
"time"
"unsafe"

"go.uber.org/zap"
Expand Down Expand Up @@ -54,6 +55,7 @@ outerLoop:
}

if err == unix.EAGAIN {
time.Sleep(time.Millisecond)
logger.Debug("uffd: eagain during polling, going back to polling")

continue
Expand Down Expand Up @@ -95,7 +97,7 @@ outerLoop:
buf := make([]byte, unsafe.Sizeof(userfaultfd.UffdMsg{}))

for {
n, err := syscall.Read(uffd, buf)
_, err := syscall.Read(uffd, buf)
if err == syscall.EINTR {
logger.Debug("uffd: interrupted read, reading again")

Expand All @@ -108,9 +110,8 @@ outerLoop:
}

if err == syscall.EAGAIN {
logger.Debug("uffd: eagain error, going back to polling", zap.Error(err), zap.Int("read_bytes", n))

// Continue polling the fd.
time.Sleep(time.Millisecond)
continue outerLoop
}

Expand Down
Loading