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

review adding timeouts to Docker API calls #9503

Open
tgross opened this issue Dec 2, 2020 · 5 comments · May be fixed by #13427
Open

review adding timeouts to Docker API calls #9503

tgross opened this issue Dec 2, 2020 · 5 comments · May be fixed by #13427
Labels
help-wanted We encourage community PRs for these issues! stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/driver/docker type/bug

Comments

@tgross
Copy link
Member

tgross commented Dec 2, 2020

From #9502:

This changeset is a minimal intervention to add the timeout to the Docker API
call only when we have the kill_timeout set. Future work should examine
whether we should be threading contexts through other go-dockerclient API
calls.

@mikenomitch
Copy link
Contributor

Hi to anybody reading this - We think this is a good first issue and good candidate for a community PR. Probably not something the HashiCorp team will get to right away though.

This would involve finding all the places where we call the docker API and adding a timeout there.

For example, for a call like this one could add a go context with a timeout.

@danishprakash
Copy link
Contributor

danishprakash commented Nov 18, 2021

@tgross sorry for spamming a bunch of issues around here but I think I'll take a shot at this one based on @mikenomitch's comment. Hope that's okay.

@tgross
Copy link
Member Author

tgross commented Nov 18, 2021

Go for it!

@Amier3 Amier3 added the help-wanted We encourage community PRs for these issues! label Apr 1, 2022
@danishprakash
Copy link
Contributor

Hey, I had a question about this. So, we're exclusively talking about attaching context as part of calls to the docker engine made from the docker client, is that correct?

Also, this could change if we're exporting a specific call e.g. driver.Signal() from @tgross's earlier PR in which case, we allow the callers to provide the context (which could be derived from higher up the call stack).

I made a small draft change for the createContainer method here keeping in mind the above two assumptions. Can someone corroborate these? Thanks

@tgross
Copy link
Member Author

tgross commented Jun 13, 2022

Hi @danishprakash!

So, we're exclusively talking about attaching context as part of calls to the docker engine made from the docker client, is that correct?

Also, this could change if we're exporting a specific call e.g. driver.Signal() from @tgross's earlier PR in which case, we allow the callers to provide the context (which could be derived from higher up the call stack).

Yes! We don't want to bubble that all the way up to the callers in client/allocrunner/taskrunner because it'll break the contract with third-party drivers. But inside the drivers/docker package should be fair game.

I made a small draft change for the createContainer method here keeping in mind the above two assumptions. Can someone corroborate these? Thanks

The CREATE: label there effectively is the top of a loop, so I think we want the context/timeout to be created before that label. But other than that, yes this looks like the generally right approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted We encourage community PRs for these issues! stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/driver/docker type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants