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

Ensure GIL during C callbacks #505

Merged
merged 1 commit into from
Jun 30, 2021
Merged

Ensure GIL during C callbacks #505

merged 1 commit into from
Jun 30, 2021

Conversation

AntoinePrv
Copy link
Contributor

During all C callbacks ensure that the GIL is held before executing Python code.

In Ecole we don't hold the GIL when calling SCIPsolve, so if users have added a callback through Python, user would get

Fatal Python error: PyThreadState_Get: no current thread

This is a prerequisite to #430 , but I think it we should do a bit more testing before actually removing the GIL in intensive methods.

@gasse
Copy link
Contributor

gasse commented Jun 29, 2021

I've had segfaults when using Ecole + an event handler registered through PySCIPOpt, which this PR seems to fix. Any reason it hasn't been merged yet ?

Related discussion about this issue here:
ds4dm/ecole#193

@CGraczyk
Copy link
Collaborator

@mattmilten do you have some insight here?

@mattmilten
Copy link
Collaborator

mattmilten commented Jun 29, 2021

I guess we can merge this. I don't see an issue and the tests pass ¯\_(ツ)_/¯

@gasse
Copy link
Contributor

gasse commented Jun 29, 2021

Awesome. It seems safe indeed. And it would greatly improve the Ecole + PySCIPOpt compatibility :)

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

Successfully merging this pull request may close these issues.

4 participants