Skip to content
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

Retry when write file busy #2810

Closed

Conversation

wzshiming
Copy link
Contributor

Fixes #2736

Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
@@ -42,7 +42,7 @@ func ReadFile(dir, file string) (string, error) {
func retryingWriteFile(fd *os.File, data string) error {
for {
_, err := fd.Write([]byte(data))
if errors.Is(err, unix.EINTR) {
if errors.Is(err, unix.EINTR) || errors.Is(err, unix.EBUSY) {
logrus.Infof("interrupted while writing %s to %s", data, fd.Name())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message is obviously not right for EBUSY case.

@kolyshkin
Copy link
Contributor

@wzshiming thank you for your PR.

As discussed in #2736, we don't think retrying on EBUSY is the adequate solution. This is a configuration error (memory limit is too tight), and the best we can do in such a case is provide a better error message (looking into that).

Are you able to reproduce the issue with adequate memory limit set?

@wzshiming wzshiming closed this Feb 19, 2021
@wzshiming wzshiming deleted the fix/write-file-busy branch February 19, 2021 03:36
@cyphar
Copy link
Member

cyphar commented Feb 19, 2021

In addition, -EBUSY is not always a transient error (unlike -EINTR) -- it's entirely possible that this will loop infinitely for some files.

@kolyshkin
Copy link
Contributor

I am working on a more specific fix (to clarify the error message and provide more diagnostics in case of error -- WIP is in #2812)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating a pod has a probability of failure
3 participants