Conversation
Consume the second sampling pass lazily and populate every column and the parent maps before advancing to the next process. This avoids retaining one procfs directory handle per process. Add a CLI regression with a synthetic procfs tree and a child-only file descriptor limit, covering threads, tree output, kernel thread filtering and command reads. Fixes dalance#766
CarterLi
added a commit
to CarterLi/procs
that referenced
this pull request
Sep 13, 2026
…ce#972) Consume the second sampling pass lazily and populate every column and the parent maps before advancing to the next process. This avoids retaining one procfs directory handle per process. Add a CLI regression with a synthetic procfs tree and a child-only file descriptor limit, covering threads, tree output, kernel thread filtering and command reads. Fixes dalance#766
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.
Fixes #766. Related: #743.
The second sampling pass retains every
procfs::Processuntil the columns are populated. Each owns a directory descriptor, so a low open-file limit silently truncates the result.Collect Linux samples lazily and populate all columns and parent maps for each process before advancing. This keeps the existing handle-based reads, without adding extra PID-based reopenings or changing resource limits. Other platforms keep their existing collectors.
The regression test builds a synthetic procfs tree with 96 processes and their threads, then runs the CLI with a child-only
RLIMIT_NOFILE=32. It covers normal output, threads, tree output, kernel-thread filtering and command-line reads. Output must match the 1024-descriptor control. On the original code, the first case shows only 28 of 96 processes.Validation:
cargo clippy --locked --all-targets -- -D warnings, also with--no-default-features; formatting passes.