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

Python sub-interpreter support #26615

Open
jabraham17 opened this issue Jan 29, 2025 · 2 comments
Open

Python sub-interpreter support #26615

jabraham17 opened this issue Jan 29, 2025 · 2 comments
Assignees

Comments

@jabraham17
Copy link
Member

#26597 added support for Python sub-interpreters in the Python interop module, but nightly testing found a number of bugs in it. I attribute this to race conditions when creating/using/destroying sub interpreters. #26614 turns off some of this testing, but this issue is to capture the failures I saw, as well as a desire to fix this.

Summary of failures

I was looking mostly at test/library/packages/Python/correctness/compareIterationPatterns.chpl and test/library/packages/Python/correctness/subInterp.chpl.

On my M1 Mac with 8 cores and Python 3.13.1, all tests ran fine. Switching to Python 3.12.7, I found subInterp.chpl would segfault on teardown of the sub-interpreter.

On a linux64 system with 48 cores and Python 3.13.0, subInterp.chpl would sometimes segfault and sometimes work. compareIterationPatterns.chpl would hang on sub interpreter creation. Notably, lowering the number of tasks with CHPL_RT_NUM_THREADS_PER_LOCALE would allow the test to continue. CHPL_RT_NUM_THREADS_PER_LOCALE=8 was fine, CHPL_RT_NUM_THREADS_PER_LOCALE=16 was not.

@bradcray
Copy link
Member

Are sub-interpreters a new-ish feature in Python? Given the closeness of the version numbers you quote, is it likely that the bugs are still being worked out of them on the Python side?

Is this something that could be reproduced in a pure Python program, and if so, is there a forum where we could report it / ask about it?

@jabraham17
Copy link
Member Author

jabraham17 commented Jan 29, 2025

They've been around for a bit, but they have changed a lot in the Python 3.12/3.13 timeframe. So it could be a Python problem (this was my initial assumption in the differences between the 3.13.1 on my laptop and 3.13.0 on the nightly machine). However, I find it equally as likely that the Python module makes a bad assumption about sub-interpreters and is using them wrong.

jabraham17 added a commit that referenced this issue Jan 29, 2025
This PR turns off Python sub-interpreter tests. These tests have wildly
unpredictable output due to race conditions. This PR also adds a warning
to the docs warning users about this.

The unpredictable behavior is caused by race conditions when
creating/destroying sub-interpreters, see
#26615.

This PR has a few other nit cleanups.

[Reviewed by @lydia-duncan]
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