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

why so many open file descriptors to the same file? #1724

Closed
withinboredom opened this issue May 11, 2024 · 2 comments
Closed

why so many open file descriptors to the same file? #1724

withinboredom opened this issue May 11, 2024 · 2 comments

Comments

@withinboredom
Copy link

withinboredom commented May 11, 2024

Description

I noticed a large jump in open file descriptors after installing Typesense. I notice that each thread creates it's own file descriptor for all files it manages (logs, etc) instead of sharing descriptors. This is over 16k open file descriptors on our server, not including socket connections. To put it in perspective, the only process using more file descriptors is netdata which has nearly every /dev and /proc file open for monitoring.

Steps to reproduce

  1. Install typesense.

Expected Behavior

For files to be opened once and shared between threads.

Actual Behavior

Each thread manages its own open files, and there are a lot of them.

Metadata

Typesense Version: 26

OS: Linux

@kishorenc
Copy link
Member

@withinboredom

How are you checking for open files? If you are using lsof, that will duplicate fds across all threads even if only a single thread is opening a file. Instead you should check via

ls /proc/$pid/fd/ | wc -l

@withinboredom
Copy link
Author

Ah, yes! I was using lsof and notice that my monitoring does as well. I will open an issue there because as you pointed out, this is not a good way of counting them :)

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

No branches or pull requests

2 participants