Message362466
> I seem to be consistingly hitting this issue.
It will help with test development if you can provide a minimal example that reliably reproduces the problem.
In msg353064 I see DuplicateHandle calls failing with ERROR_ACCESS_DENIED (5). Assuming the process handles have the required PROCESS_DUP_HANDLE access, it's most likely the case that the underlying NtDuplicateObject system call is failing with STATUS_PROCESS_IS_TERMINATING (0xC000010A). For example:
import ctypes
ntdll = ctypes.WinDLL('ntdll')
from subprocess import Popen, PIPE
from _winapi import GetCurrentProcess, TerminateProcess
from _winapi import DuplicateHandle, DUPLICATE_SAME_ACCESS
p = Popen('cmd.exe', stdin=PIPE, stdout=PIPE, stderr=PIPE)
TerminateProcess(p._handle, 0)
Try to duplicate the process handle into the terminated process:
>>> source = GetCurrentProcess()
>>> target = handle = p._handle
>>> try:
... DuplicateHandle(source, handle, target,
... 0, False, DUPLICATE_SAME_ACCESS)
... except:
... status = ntdll.RtlGetLastNtStatus()
... print(f'NTSTATUS: {status & (2**32-1):#010x}')
... raise
...
NTSTATUS: 0xc000010a
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
PermissionError: [WinError 5] Access is denied |
|
Date |
User |
Action |
Args |
2020-02-22 13:44:17 | eryksun | set | recipients:
+ eryksun, pitrou, vstinner, s0undt3ch, pablogsal |
2020-02-22 13:44:17 | eryksun | set | messageid: <1582379057.06.0.632585173597.issue38263@roundup.psfhosted.org> |
2020-02-22 13:44:17 | eryksun | link | issue38263 messages |
2020-02-22 13:44:16 | eryksun | create | |
|