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

Too many close() syscall when collecting data #417

Open
jimmyxian opened this issue Apr 24, 2019 · 1 comment
Open

Too many close() syscall when collecting data #417

jimmyxian opened this issue Apr 24, 2019 · 1 comment

Comments

@jimmyxian
Copy link

In my environment, about 1000000 close() syscalls produced by my own collector every 10 seconds. Almost takes 300ms when doing close FDs.
After analysis, I find the following reasons.

        def _close_fds(self, but):
            if hasattr(os, 'closerange'):
                os.closerange(3, but)
                os.closerange(but + 1, MAXFD)
            else:
                for i in xrange(3, MAXFD):
                    if i == but:
                        continue
                    try:
                        os.close(i)
                    except:
                        pass
  • In my env, MAXFD=1000000

Also, after review the history patch, I find the patch which set close_fds from False to True. 7b5659d#diff-50bd42e8d38bbdf7c24f69ae5e25165f @tsuna

Any good idea to solve to this?

@vasiliyk
Copy link
Member

Xian, could you reconfirm that you can still reproduce the bug?

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