Conversation
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit 67e5509. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6dc71b4644
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| logger.L().Info(ctx, "fc process is in the D state after we call SIGKILL", logger.WithSandboxID(p.files.SandboxID)) | ||
| } | ||
|
|
||
| logger.L().Info(ctx, "sent SIGKILL to fc process", logger.WithSandboxID(p.files.SandboxID), zap.String("state", state)) |
There was a problem hiding this comment.
I would guess that getProcessState() will most commonly return error because process was killed and reaped and it no longer exists (kill syscall returns when signal was delivered). Therefore I would expect state equal to "" in most cases. I would suggest to change it to something like this:
state, err := getProcessState(ctx, p.cmd.Process.Pid)
if err != nil {
// undecided what exactly to do here, because `err` is mostly a good sign here original `Warn()` is a bit misleading.
} else {
logger.L().Info(ctx, "sent SIGKILL to fc process", logger.WithSandboxID(p.files.SandboxID), zap.String("state", state))
}There was a problem hiding this comment.
I don't like getProcessState() function. Calling extra process for one letter from /proc/<pid>/stat file is overkill. gopsutils has StatusWithContext() but it maps Linux letters to strings https://github.com/shirou/gopsutil/blob/c2a1624b9f3ed0b38ad67134b93397142ed67a23/process/process.go#L609
Log the process state even if in another state than
D