Skip to content

Conversation

@ShirleyFei
Copy link
Contributor

This patch collects and displays the current number of opened file descriptors for each process to monitor if fd leaks. As each thread has the same fds with its process, there is no need to collect each thread's fd numbers then.

Considering users may set the nr_open limit to a very large number, we use getdents[64] SYSCALL directly to get fd numbers instead of glibc's readdir() for performance consideration.

Also, define MAX_OPEN to be 1024 * 1024 for display even if the fd numbers may exceed 1024 * 1024.

Signed-off-by: Fei Li lifei.shirley@bytedance.com

This patch collects and displays the current number of opened file
descriptors for each process to monitor if fd leaks. As each thread
has the same fds with its process, there is no need to collect each
thread's fd numbers then.

Considering users may set the nr_open limit to a very large number,
we regard MAX_OPEN to be 10000 to avoid further performance
degradation.

Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
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.

1 participant