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

Process.parent() may swallow NoSuchProcess exceptions #606

Closed
giampaolo opened this issue Mar 11, 2015 · 0 comments
Closed

Process.parent() may swallow NoSuchProcess exceptions #606

giampaolo opened this issue Mar 11, 2015 · 0 comments
Labels

Comments

@giampaolo
Copy link
Owner

...and return None instead. Problem is here:

if parent.create_time() <= self.create_time():

This is a race condition as the process may be alive at ppid = self.ppid() but not at self.create_time(). It's a very small time frame but the issues technically exists.

mrjefftang added a commit to mrjefftang/psutil that referenced this issue Mar 24, 2015
* master:
  use 'with open' to make sure file is closed
  test_process_create_time: always test against the rounded time too
  don't test physical cpu count on systems that don't include it
  don't test num_ctx_switches on unsupported kernels
  fix compilation warning about possible misuse of XDECREF
  fix race condition in wait_for_file
  fix flake8 error
  fix permission errors when running from /root
  fix giampaolo#607: DUPLEX_UNKNOWN is not defined on old RedHat versions
  fix giampaolo#606: Process.parent() may swallow NoSuchProcess exceptions (#race-condition)
  attempt to fix xargs on OSX
  giampaolo#602: move pre-commit hook into a separate file
  fix giampaolo#602: add GIT pre-commit hook
  fix failing test on Windows
  C styling: if unification
  forgot to close the handle
  fix giampaolo#599 (Windows): process name() can now be determined for all PIDs
  add test
  windows: refactoring of the alternative process info implementation
  fix typo in documentation
@giampaolo giampaolo added the bug label Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant