Skip to content

Avoid unclean interpreter shutdown #942

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

Merged
merged 3 commits into from
Jul 6, 2023

Conversation

robsdedude
Copy link
Member

When not closing the driver before shutting down the interpreter, the GC might call __del__ on the driver, which currently (will be changed with 6.0) closes the driver. So any code that's run on driver closure might be execute just before the interpreter shuts down. This can lead to funky errors when trying to import things dynamically. So this should be avoided.

This got raised here:
https://community.neo4j.com/t/error-with-the-neo4j-python-driver-importerror-sys-meta-path-is-none-python-is-likely-shutting-down/63096/

When not closing the driver before shutting down the interpreter, the GC might
call `__del__` on the driver, which currently (will be changed with 6.0) closes
the driver. So any code that's run on driver closure might be execute just
before the interpreter shuts down. This can lead to funky errors when trying to
import things dynamically. So this should be avoided.

This got raised here:
https://community.neo4j.com/t/error-with-the-neo4j-python-driver-importerror-sys-meta-path-is-none-python-is-likely-shutting-down/63096/
Copy link

@AndyHeap-NeoTech AndyHeap-NeoTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to make sense to me.

@robsdedude robsdedude merged commit 1e5c7f9 into neo4j:5.0 Jul 6, 2023
@robsdedude robsdedude deleted the fix-unclean-interpreter-shutdown branch July 6, 2023 11:00
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.

2 participants