-
Notifications
You must be signed in to change notification settings - Fork 950
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
bugfix: create fifo is not exist #1766
Conversation
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.
Could you mind to provide more information about this, like bug background, reproduce condition?
pouchd重启后,fifo文件不见, 容器recovery失败, 触发原因 task exit channel异常退出,把io关掉了,就删了fifo,不是每次异常退出都会到close io
|
See, you can put the main message as the comment for the function, right? 😄 |
You can see the fifo has a |
Codecov Report
@@ Coverage Diff @@
## master #1766 +/- ##
==========================================
+ Coverage 56.32% 56.35% +0.03%
==========================================
Files 200 200
Lines 15657 15659 +2
==========================================
+ Hits 8819 8825 +6
+ Misses 5742 5741 -1
+ Partials 1096 1093 -3
|
Signed-off-by: Ace-Tang <aceapril@126.com>
@@ -116,6 +116,12 @@ func copyIO(fifos *containerdio.FIFOSet, ioset *ioSet, tty bool) (_ *wgCloser, e | |||
} | |||
}() | |||
|
|||
// if fifos directory is not exist, create fifo will fails, | |||
// also in case of fifo directory lost in container recovery process. | |||
if _, err := os.Stat(fifos.Dir); err != nil && os.IsNotExist(err) { |
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.
if the error is not 404 not found, should we return it directly?
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.
At first , 404 cause by http, then, we deal with non-exist file error to make fifo can be created successful.
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.
404 is metaphor. I means that if the os.IsNotExist(err)
is false, should we return err directly?
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.
No, I means we only need to deal this kind error, and not check Mkdir's return.
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.
But the Mkdir
maybe fail, right? And if os.IsNotExist(err)
is false, I don't think it's necessary to execute the following statements. how do you think?
cc @allencloud
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.
We do not care about if mkdir' return, since if it fails , it means other problem, here we just deal with the problem the directory is not exist, so we also not deal with other error besides os.IsNotExist(err)
.
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.
If other problem exist, fifo create will return. I do not want return error in the add funtion.
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 fifo
will catch error if the mkdir
fails to create dir. It's nit, but LGTM
Signed-off-by: Ace-Tang aceapril@126.com
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews