socket: try removing if socket-location is a directory on Linux#74
Open
thaJeztah wants to merge 1 commit intodocker:mainfrom
Open
socket: try removing if socket-location is a directory on Linux#74thaJeztah wants to merge 1 commit intodocker:mainfrom
thaJeztah wants to merge 1 commit intodocker:mainfrom
Conversation
Member
Author
|
Oops, didn't stage some files and pushed the wrong version; fixing now |
e176027 to
5e0d908
Compare
Member
Author
|
done 😅 |
tiborvass
reviewed
Aug 29, 2020
| 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 { |
Contributor
There was a problem hiding this comment.
OS X and Linux differ on whether unlink(dir)
returns EISDIR,
Member
Author
There was a problem hiding this comment.
Ah, interesting. I guess it's still ok to retry on Linux only then? Added a comment
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 <github@gone.nl>
52be987 to
b93e89d
Compare
Member
Author
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.