-
Notifications
You must be signed in to change notification settings - Fork 2.4k
container/crio: retry getting pid if 0 #2284
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
Merged
Merged
Conversation
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
Contributor
|
👍 |
Contributor
Author
|
fyi @Reamer |
|
Hi @sjenning, |
Reamer
pushed a commit
to Reamer/origin
that referenced
this pull request
Aug 8, 2019
Reamer
added a commit
to Reamer/origin
that referenced
this pull request
Aug 8, 2019
|
I think you have a small typo. diff --git a/container/crio/handler.go b/container/crio/handler.go
index 7d0c5a83..d9eab06e 100644
--- a/container/crio/handler.go
+++ b/container/crio/handler.go
@@ -296,7 +296,7 @@ func (self *crioContainerHandler) getLibcontainerHandler() *containerlibcontaine
}
self.pidKnown = true
- self.libcontainerHandler = containerlibcontainer.NewHandler(self.cgroupManager, self.rootFs, cInfo.Pid, self.ignoreMetrics)
+ self.libcontainerHandler = containerlibcontainer.NewHandler(self.cgroupManager, self.rootFs, cInfo.Pid, self.includedMetrics)
return self.libcontainerHandler
} |
Contributor
Author
|
ah yes, I made this patch against origin 3.11 vendor tree and that changed in master |
98cb778 to
73b0de8
Compare
Contributor
Author
|
/assign @dashpole |
Contributor
|
/retest |
dashpole
approved these changes
Aug 9, 2019
Collaborator
dashpole
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This was referenced Aug 9, 2019
Merged
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.
When a container is created, cadvisor creates a handler, triggered by inotify. In the case of a crio managed container, the crio handler immediately queries crio for the pid of the just created container. Due to performance concerns in crio, the pid might not yet be known and thus returns 0. If the pid is 0, then network stats are not collected for the lifetime of the container or the lifetime of cadvisor, whichever is shorter.
https://github.com/google/cadvisor/blob/master/container/libcontainer/handler.go#L80-L83
This PR changes the crio handler to requery crio for the pid if the pid was unknown during handler initialization or the last
GetStat()call. Once the pid becomes known, the libcontainer handler with the non-zero pid is cached and no further crio queries are needed.Fixes openshift/origin#23492
@mrunalp @dashpole