neo4j-contrib/neomodel

Relying on Driver's destructor to close the session is deprecated.

aymenalitaleb opened this issue · 1 comments

Expected Behavior (Mandatory)

I was expecting the driver to close automaticlly, since I upgraded neo4j to 5.11.0 I started having this problem. Note that I'm not using from neo4j import GraphDatabase.

Actual Behavior (Mandatory)

****\venv\lib\site-packages\neo4j\_sync\driver.py:485: ResourceWarning: Unclosed <neo4j._sync.driver.BoltDriver object at 0x000001A7D7B1F370>.
Enable tracemalloc to get the object allocation traceback.
****\venv\lib\site-packages\neo4j\_sync\driver.py:489: DeprecationWarning: Relying on Driver's destructor to close the session is deprecated. Please make sure to close the session. Use it as a context (`with` statement) or make sure to call `.close()` explicitly. Future versions of the driver will not close drivers automatically.

How to Reproduce the Problem

Anytime I try to interact with the database

Screenshots (where it's possibile)

Specifications (Mandatory)

Currently used versions 5.1.0

Versions

  • OS: Windows 10
  • Library: neomodel 5.1.0
  • Neo4j: 5.11.0

Hello @aymenalitaleb , please see notes on this PR regarding managing the driver.