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

thread checker, case where docker container has already stopped #717

merged 3 commits into from Oct 8, 2015


Copy link

@ssalinas ssalinas commented Oct 5, 2015

@tpetr found our docker threads issue. In the case where we inspect the container, but it has already stopped, the pid returns as 0. This is due to the docker daemon's response to inspect, not the client's processing. The wrapper checks every few seconds for the container to be running, so a badly timed thread check will throw up the error we saw with /proc/0/cgroup

So, I've added a check that if the pid is 0, we check that it is running. If it isn't running, we return 0. No need for throwing sentry errors when we are about to shut down anyways and nothing is really wrong

dockerPid = Optional.of(dockerClient.inspectContainer(containerName).state().pid());
int possiblePid = dockerClient.inspectContainer(containerName).state().pid();
if (possiblePid == 0) {
LOG.warn(String.format("Container %s has pid 0. Running: (%s). Will not try to get threads", containerName, dockerClient.inspectContainer(containerName).state().running()));
Copy link

Choose a reason for hiding this comment

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

i'd suggest "Container %s has pid %s (running: %s). Defaulting to 0 threads running."

Copy link
Member Author

ssalinas commented Oct 5, 2015

@tpetr updated the message

@tpetr tpetr added the hs_qa label Oct 5, 2015
@tpetr tpetr added this to the 0.4.6 milestone Oct 7, 2015
tpetr pushed a commit that referenced this pull request Oct 8, 2015
thread checker, case where docker container has already stopped
@tpetr tpetr merged commit 280ef1b into master Oct 8, 2015
@tpetr tpetr removed hs_qa labels Oct 8, 2015
@tpetr tpetr deleted the docker_threads branch October 8, 2015 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants