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

Remote monitor mode not available for python >3.8 ? #45

Open
lionel-ovaert opened this issue Aug 9, 2023 · 1 comment
Open

Remote monitor mode not available for python >3.8 ? #45

lionel-ovaert opened this issue Aug 9, 2023 · 1 comment

Comments

@lionel-ovaert
Copy link

Hi, I'm using python 3.10 in one of my projects and wanted to use the remote monitoring mode from guppy3. However, after adding
import guppy.heapy.RM I get an error saying AttributeError: module 'guppy.heapy.heapyc' has no attribute 'interpreter'.

After some digging, I found that the interpreter is not available for python version above 3.8 (found here)

Is there any specific reason for this ? In the Readme, it's specified that the package works with python 3.9, 3.10 and 3.11.

Any help here would be appreciated :)

@zhuyifei1999
Copy link
Owner

Hi, this was initially disabled in commit 15fa02d. If I remember correctly it was related to the GIL being refactored, and in our architecture of starting an interpreter in a new thread, the new thread is unable to send a GIL drop request to the original interpreter, causing some deadlock to happen, as far as I remember.

I was also originally waiting on PEP 554 and see how I can potentially make use of it, but it's been delayed and delayed and delayed and delayed. The initial code of that PEP was in python/cpython#76785 which was almost 5 years ago!

The reason subinterpreters are used here aren't just for isolating objects between interpreters, but also to make the stdout/stderr point to the remote connection. Otherwise if you do sys.stdout.write it'd write to the program's stderr. However, since Python is going for per-interpreter GILs, it's extremely unsafe to hold an object across interpreters, and since guppy literally allows one to grab a reference to any object in the system, I'm not even sure what to do at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants