-
Notifications
You must be signed in to change notification settings - Fork 102
socket: try removing if socket-location is a directory on Linux #74
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: master
Are you sure you want to change the base?
Conversation
Oops, didn't stage some files and pushed the wrong version; fixing now |
e176027
to
5e0d908
Compare
done 😅 |
return nil, err | ||
// Using syscall.Unlink(), not os.Remove() to prevent deleting the socket if it's in use | ||
if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) { | ||
if err != syscall.EISDIR { |
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.
OS X and Linux differ on whether unlink(dir)
returns EISDIR,
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.
Ah, interesting. I guess it's still ok to retry on Linux only then? Added a comment
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.
Also added a test
111e345
to
19cabb7
Compare
afda0fa
to
56ccd56
Compare
05e56ab
to
52be987
Compare
Due to race-conditions between containers starting and the Docker remote API being up, containers bind-mounting the docker-socket may cause the socket-path to be created as a directory. This patch will attempt to remove the directory in such situations. Removing will fail if the directory is not empty. MacOS does not allow us to detect that the path is a directory, and we'll return immediately instead of retrying. Signed-off-by: Sebastiaan van Stijn <[email protected]>
52be987
to
b93e89d
Compare
macOS is failing due to the tempdir-location and/or permissions of it; I'll have to look at that; not a "real" failure, just have to look at how to make the test work
|
Alternative for #72. Relates to moby/moby#41392
Due to race-conditions between containers starting and the Docker remote API being up, containers bind-mounting the docker-socket may cause the socket-path to be created as a directory.
This patch will attempt to remove the directory in such situations. Removing will fail if the directory is not empty.