Skip to content

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
@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