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

Do.Once docker client initialization #556

Merged
merged 1 commit into from
Dec 11, 2015
Merged

Conversation

dadgar
Copy link
Contributor

@dadgar dadgar commented Dec 10, 2015

Only initialize the docker client once to avoid leaking unix domain socket connections to the docker daemon.

}

var err error
createClient.Do(func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious if Once.Do has implications with periodic fingerprinting. For example if we run the fingerprinter once and the client fails because docker is not running yet, does that mean we can't connect later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well if it failed, then we would return false on the fingerprinter anyways so the node wouldn't say it had docker capabilities.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we ran fingerprinters periodically, though. If so it could fail if nomad starts before Docker, and would then succeed on a subsequent fingerprint pass.

So on the second call I think client would still be nil but the Once.Do would prevent the initialization from firing again.

We would fall through and return nil, nil.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we ran fingerprinters periodically, though. If so it could fail if nomad starts before Docker, and would then succeed on a subsequent fingerprint pass.

I'm currently using Systemd to make sure Nomad is started after Docker. The same could be done in Upstart. I think that's a fair assumption.

dadgar added a commit that referenced this pull request Dec 11, 2015
Do.Once docker client initialization
@dadgar dadgar merged commit 8be637b into master Dec 11, 2015
@dadgar dadgar deleted the b-cache-docker-client branch December 11, 2015 00:19
@github-actions
Copy link

github-actions bot commented May 1, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants