Skip to content

time-box the docker client to avoid ever getting stuck#773

Merged
wsorenson merged 4 commits into
masterfrom
time_limited_docker
Jan 4, 2016
Merged

time-box the docker client to avoid ever getting stuck#773
wsorenson merged 4 commits into
masterfrom
time_limited_docker

Conversation

@ssalinas

Copy link
Copy Markdown
Contributor

It seems that we can get into an odd state when contacting the docker daemon. Even with the appropriate timeouts (default apache client in this case) set, we can still get into a situation where we try to contact the docker daemon then hang there forever. While the root problem lies in the docker daemon, it shouldn't stop the executor from being able to shut down properly.

This optionally creates a time limit for all calls using the docker daemon to avoid things hanging and causing an executor process that will simply wait forever doing nothing.

@jhaber

jhaber commented Nov 23, 2015

Copy link
Copy Markdown
Member

Would you still have a stuck thread? If so, doesn't this just hide a resource leak and eventually you could run out of threads or HTTP connections?

@ssalinas

Copy link
Copy Markdown
Contributor Author

From my testing while things were in the stuck state, interrupting the thread / killing the process will still stop it correctly. Maybe stuck was a bad word, the docker daemon call just never returns and never times out

@jhaber

jhaber commented Nov 23, 2015

Copy link
Copy Markdown
Member

Interesting, maybe we should PR the spotify docker client if it's not respecting timeouts

@ssalinas

Copy link
Copy Markdown
Contributor Author

spotify docker client is just using apache http client underneath, default timeouts for connect and read get set to 5 and 30 seconds. I think the current bug with the docker daemon is that it keeps the connection open in such a way that the timeouts do no get hit, thus the usage of TimeLimiter here instead (docker cli calls and calls to docker daemon from any source/client hang as well)

The bug is a rare case and the purpose of the PR is more to limit our executor from being pinned by it. If we can't launch something because docker is in a bad state, call it failed and move on.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could we include the timeout duration here? (i.e. Timed out trying to reach docker daemon after N seconds)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

@tpetr tpetr added this to the 0.4.8 milestone Dec 31, 2015

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should use the {} instead of String.format

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@wsorenson updated

wsorenson added a commit that referenced this pull request Jan 4, 2016
time-box the docker client to avoid ever getting stuck
@wsorenson wsorenson merged commit 9339962 into master Jan 4, 2016
@tpetr tpetr removed hs_qa labels Jan 4, 2016
@ssalinas ssalinas deleted the time_limited_docker branch February 9, 2016 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants