-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[MacOS] Race condition in Process.get_connections randomly raises AccessDenied #1901
Comments
Signed-off-by: Giampaolo Rodola <[email protected]>
I submitted a PR (#1903) which I think should solve this issue, but since I cannot reproduce it, it would be good it you try it first. Can you clone the repo and try that branch? Here's how to do it:
|
@marouane-miftah can I leave the retest to you? |
yes |
I am still getting the same error with the new branch. |
I added some debug prints. Please
|
@giampaolo, hope this helps.
../../miniconda3/envs/x/lib/python3.8/site-packages/pshell/procs.py:241: in wait_for_server proc = <psutil._psosx.Process object at 0x7fc4206c1240>
E psutil.AccessDenied: psutil.AccessDenied (pid=23261) ../../miniconda3/envs/x/lib/python3.8/site-packages/psutil/_psosx.py:378: AccessDenied |
Mmm no. I don't see any debug message and the original
|
@giampaolo, I have run it as you described but I am note getting any extra DEBUG messages I also tried export the env variable first as so, and can verify that it was set properly at the end after the error is triggered.
|
This was done in order to solve #1044 and #1100 ...but its logic duplicates the one in wrap_exceptions() decorator. Also, this should solve #1901 as it did erroneously translated NSP in AD. Signed-off-by: Giampaolo Rodola <[email protected]>
OK, I pushed some changes into |
sorry @giampaolo still the same error. |
Mmm weird.
Run:
Before the patch it raised AccessDenied, now it raises NoSuchProcess (as it should). |
This issue has been automatically closed because there has been no response for more information from the original author. Please reach out if you have or find the answers requested so that this can be investigated further. |
Signed-off-by: Giampaolo Rodola <[email protected]>
This issue has been automatically closed because there has been no response for more information from the original author. Please reach out if you have or find the answers requested so that this can be investigated further. |
PR merged. This issue should have been fixed. |
Summary
Description
The following code starts a vanilla HTTP server, which runs in the foreground (doesn't fork/daemonize) and listens on a single TCP/IP port. The wrapper waits for the subprocess to start listening before it returns:
Expected behaviour
The above code either
psutil.NoSuchProcess
, if the subprocess dies before it opens the port, orObserved behaviour
Occasionally, if the subprocess dies in the middle of a call to
Process.connections()
, the above code raisespsutil.AccessDenied
. This makes no sense to me as I'm the user that started the process to begin with.I know for sure that the subprocess died before it even started tampering with its sockets.
Stack trace:
The text was updated successfully, but these errors were encountered: