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

Use PyMem_RawFree when resetting PythonEnvironmentData #447

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

fredroy
Copy link
Contributor

@fredroy fredroy commented Sep 9, 2024

runSofa + SofaPython3 is crashing when quitting (since I dont know when) ?
After investigation, PyMem_Free is called without GIL, which is illegal.

python/cpython#105690

I guess this behavior started when clearing the env when unloading (#432), plus python 3.12

Instead we must call PyMem_RawFree which allows us to delete non-obj (our case) without the gil.

PS1: the whole PySys_SetArgvEx stuff is deprecated and will need a rewrite.
PS2: I am skeptical about the needs to store the m_argv, etc 🤔

@hugtalbot
Copy link
Contributor

Awesome debug @fredroy
Do you want to discuss it further at the SOFA dev meeting ? Else LGTM

@bakpaul bakpaul merged commit 95b7a14 into sofa-framework:master Sep 9, 2024
4 checks passed
@fredroy fredroy deleted the fix_pymem_nogil branch September 9, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants