Ignore forked but not exec'd child processes#1302
Merged
Conversation
This commit introduces code into the procfs Sampler such that discovered children that are not exec'd yet are not polled. We have found that in rare cases this causes a double-count of the parent's memory, although it's not accumulated as such by Linux itself. Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
scottopell
approved these changes
Mar 27, 2025
lading/src/observer/linux/procfs.rs
Outdated
| // This is a new process. We initialize its | ||
| // process info and then determine by | ||
| // examination of the exe/cmdline if the process | ||
| // is not exec'd -- meaning we will not poll it |
Contributor
There was a problem hiding this comment.
Suggested change
| // is not exec'd -- meaning we will not poll it | |
| // is fork'd but not exec'd -- meaning we will not poll it |
lading/src/observer/linux/procfs.rs
Outdated
| let parent_info = match initialize_process_info(parent_pid).await { | ||
| Ok(Some(info)) => info, | ||
| Ok(None) => { | ||
| warn!("Could not initialize parent process info"); |
Contributor
There was a problem hiding this comment.
I was going back and forth on whether this is fatal or not, and I agree that this is fine to return Ok, if we return an Err, then the observer server will crash and this will never retry, which is not the behavior we want. This is a retry-able error.
Contributor
There was a problem hiding this comment.
To your point, this is an error and not a warning.
Technically lading recovers but an error has happened that results in unexpected results.
preinlein
approved these changes
Mar 27, 2025
This was referenced Mar 27, 2025
Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
Collaborator
Author
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
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.

What does this PR do?
This commit introduces code into the procfs Sampler such that discovered
children that are not exec'd yet are not polled. We have found that in
rare cases this causes a double-count of the parent's memory, although it's
not accumulated as such by Linux itself.