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

don't release GIL in Dataset.__init__ #1193

Closed
wants to merge 1 commit into from
Closed

Conversation

jswhit
Copy link
Collaborator

@jswhit jswhit commented Sep 22, 2022

potential fix for issue #1192

@dopplershift
Copy link
Member

Personally, I think it's a mistake for users to rely on the GIL to make netcdf "threadsafe".

@jswhit
Copy link
Collaborator Author

jswhit commented Sep 22, 2022

Understood @dopplershift. Perhaps the GIL may have been prevented some segfaults in versions before 1.6.1, but results still may have been incorrect.

@ocefpaf
Copy link
Collaborator

ocefpaf commented Oct 4, 2022

What is the advantage to maintain this part of the code and let users fix it instead vs merging this to safe guard bad use? My impression is that most folks opening issues don't even know they are abusing the GIL there.

@dopplershift
Copy link
Member

Previously, the library was inconsistently releasing the GIL, as in: some methods were already releasing it and were thread unsafe. (I've personally encountered crashes as a result). So to truly solve the problem and eliminate all potential crashes due to Python-based multithreading, you'd need to not only revert #1181, but #370 as well, and make sure ALL calls hold the GIL.

Personally, I'd rather have the option for better performance for use cases that aren't trying to use multiple netCDF files, but doing other things concurrently in the interpreter. I do see that this change has been a bit disruptive, so I'm not going to fight for it. It's also not my library, so my opinion counts very little. 😉

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.

3 participants