-
Notifications
You must be signed in to change notification settings - Fork 2.2k
bug:fix runc delete run before delete exec.fifo #4735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@ningmingxiao can you provide a reproducer? |
I add some sleep at
runc create nmx001 |
d1560e6
to
4446f72
Compare
I think RemoveAll is better |
In its current implementation, and if err := os.Remove(path)
if err == nil || os.IsNotExist(err) {
return nil
} but in a (theoretically possible) case when path is a non-empty directory, it will go ahead and remove it recursively, which is probably not what we really want here. I would prefer an error in such a case (even if it doesn't look like it's practically possible). |
done, thanks @kolyshkin |
ping @kolyshkin can this pr be merged ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: ningmingxiao <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug related to the improper deletion of exec.fifo, which causes issues when runc delete is executed before deleting exec.fifo.
- Updated error handling in handleFifoResult to ignore os.IsNotExist errors during file removal.
- Prevents an error from being returned when exec.fifo is already removed, ensuring smooth deletion of the container's root directory.
@@ -290,7 +290,11 @@ func handleFifoResult(result openResult) error { | |||
if err := readFromExecFifo(f); err != nil { | |||
return err | |||
} | |||
return os.Remove(f.Name()) | |||
err := os.Remove(f.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated error handling correctly ignores errors when exec.fifo does not exist, which fixes the bug. Consider adding a debug log when an unexpected error occurs to help diagnose issues in production environments.
Copilot uses AI. Check for mistakes.
@Copilot Do you think this is really a bug. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses a bug where deleting the container's exec.fifo file causes an error if the file no longer exists.
- Modified the error handling in handleFifoResult to ignore os.IsNotExist errors when removing the exec.fifo file.
- Ensures os.Remove is checked before returning any errors, preventing spurious failures.
I think Copilot can't talk with us here. @ningmingxiao @kolyshkin WDYT |
if runc delete run before delete exec.fifo
runc delete will container root dir "delete /runc/nmx003"
os.remove will reurn a error
ERRO[0030] remove /run/runc/nmx003/exec.fifo: no such file or directory