util: fix race condition in WaitForFile#3162
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Is this for slirp4netns API socket? |
IIRC, the ready-fd is written by the slirp4netns |
|
LGTM |
vrothberg
left a comment
There was a problem hiding this comment.
I think we can simplify the code with using case <- time.After(...) in line 129. Then we could delete lines 108-122 entirely.
yes good point. I'll change it |
TomSweeneyRedHat
left a comment
There was a problem hiding this comment.
LGTM assuming happy tests
|
/hold |
I feel this is a bug. I opened rootless-containers/slirp4netns#90 |
82f9540 to
9aba820
Compare
|
/hold cancel Pushed a new version that simplifies it even further and doesn't use any go routine |
There was a problem hiding this comment.
Should we be checking if os.IsNotExist(err) and blowing up if the err is something else?
There was a problem hiding this comment.
I had moved the existing code, but yes that is better. I've pushed a new version where it checks the error type.
9aba820 to
a6cc93c
Compare
|
LGTM, |
|
Tests are very angry |
|
Looks like exec broke |
541f7f7 to
390f29c
Compare
enable polling also when using inotify. It is generally useful to have it as under high load inotify can lose notifications. It also solves a race condition where the file is created while the watcher is configured and it'd wait until the timeout and fail. Closes: containers#2942 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
let the writer of the channel close it. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
390f29c to
f86bb56
Compare
|
@mheon tests are passing now |
|
/lgtm |
enable polling also when using inotify. It is generally useful to
have it as under high load inotify can lose notifications. It also
solves a race condition where the file is created while the watcher
is configured and it'd wait until the timeout and fail.
Closes: #2942
Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com