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. Process.terminate() may fail with ERROR_INVALID_HANDLE #1424

Closed
giampaolo opened this issue Feb 21, 2019 · 0 comments
Closed

Windows. Process.terminate() may fail with ERROR_INVALID_HANDLE #1424

giampaolo opened this issue Feb 21, 2019 · 0 comments

Comments

@giampaolo
Copy link
Owner

Acknoledgement of this originated from the following Windows failure re. Python subprocess module:
https://ci.appveyor.com/project/giampaolo/psutil/builds/22546914/job/rlp112gffyf2o30i
https://bugs.python.org/issue36067

======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_halfway_terminated_process
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\projects\psutil\psutil\tests\test_process.py", line 85, in tearDown
    reap_children()
  File "c:\projects\psutil\psutil\tests\__init__.py", line 493, in reap_children
    subp.terminate()
  File "C:\Python35-x64\lib\subprocess.py", line 1092, in terminate
    _winapi.TerminateProcess(self._handle, 1)
OSError: [WinError 6] The handle is invalid

psutil currently does not catch ERROR_INVALID_HANDLE so basically it has the same issue. This is hard to replicate because the process should disappear between OpenProcess and TerminateProcess calls, see here. Still, we know from subprocess module that the risk is non-zero.

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

1 participant