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

[Windows] Incredibly slow performance with process_iter and open_files #1883

Closed
pyoor opened this issue Nov 17, 2020 · 1 comment
Closed

Comments

@pyoor
Copy link

pyoor commented Nov 17, 2020

Platform

  • Microsoft Windows 10 20H2
  • psutil 5.7.3
  • Python 3.8

Using psutil.process_iter on a Windows 10 virtual machine (VirtualBox) with the open_files attribute is incredibly slow. Some processes take minutes to iterate over. I have been unable to reproduce this under bare-metal but it occurs consistently for me in several VMs. Is this an issue with psutil or something with the Windows VM?

for proc in process_iter(attrs=["name", "open_files"]):
  print(proc.info)
@giampaolo
Copy link
Owner

From https://psutil.readthedocs.io/en/latest/#psutil.Process.open_files

Warning: on Windows this method is not reliable due to some limitations of the underlying Windows API which may hang when retrieving certain file handles. In order to work around that psutil spawns a thread to determine the file handle name and kills it if it’s not responding after 100ms. That implies that this method on Windows is not guaranteed to enumerate all regular file handles (see issue 597). Tools like ProcessHacker has the same limitation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants