-
Notifications
You must be signed in to change notification settings - Fork 3k
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 10: AZ cli 2.20.0+ fails psutil.AccessDenied when executed by process with path longer than 107 chars #19193
Comments
Parent issue: |
@jiasli for awareness |
I tracked the issue to psutil python lib 32b running under wow64 WIN10 64b causing this issue. |
Thanks @PetrPospisil for the comprehensive analysis. I can repro by launching a very long process like # test.py
import psutil
import os
print(psutil.Process(PID).name())
64-bit Python shows no problem:
We do have a plan to use 64-bit Python (#18766), but it has not yet been started. For now, let me submit a PR to ignore |
I submited PR to the PSUtil lib |
Describe the bug
The issue is in python distro you are using. "psutil" lib fails with error psutil.AccessDenied
Introduced in 2.20.0 when you started to use psutil lib. Tried multiple AZ CLI versions (2.20.0, ..., 2.27.0)
To Reproduce
1] Install AZ CLI
2] Start some random process that has path longer than 107 characters and remember its PID
3] Execure your distro python with script
import psutil
import os
print(psutil.Process(PID).name())
3] It fails with an error:
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>python C:\test\test.py
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_common.py", line 447, in wrapper
AttributeError: _cache
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_pswindows.py", line 679, in wrapper
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_common.py", line 450, in wrapper
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_pswindows.py", line 766, in exe
PermissionError: [WinError 24] The program issued a command but the command length is incorrect: '(originated from NtQuerySystemInformation)'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\users\safetica\downloads\test.py", line 4, in
print(psutil.Process(7192).name())
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/init.py", line 617, in name
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_pswindows.py", line 750, in name
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_pswindows.py", line 681, in wrapper
psutil.AccessDenied: psutil.AccessDenied (pid=7192)
Expected behavior
I expect to succeed without an error.
Environment summary
OS Name: Microsoft Windows Server 2019 Datacenter
OS Version: 10.0.17763 N/A Build 17763
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Server
OS Build Type: Multiprocessor Free
Hotfix(s): 6 Hotfix(s) Installed.
[01]: KB5004332
[02]: KB4486153
[03]: KB4535680
[04]: KB4589208
[05]: KB5003711
[06]: KB5004244
Additional context
I tried manually other python distros (3.8.10, 3.9.6, ...) using psutil lib (python.exe -m pip install psutil) and no failure occured. So I suspect that your python distro is somehow broken.
The text was updated successfully, but these errors were encountered: