-
Notifications
You must be signed in to change notification settings - Fork 201
Closed
Labels
Description
Bug Report
When the driver is used after it has been closed, it may open up new resources. But the _closed
state is not reset, and so deleting a driver with open resources may leave abandoned, open resources.
Example code
Here is an example of how this might occur:
import neo4j
driver = neo4j.GraphDatabase.driver(uri, (username, password))
driver.verify_connectivity()
print(f"{driver._closed}, {len(driver._pool.connections}") # False, 1
driver.close()
print(f"{driver._closed}, {len(driver._pool.connections}") # True, 0
# del driver # this would be safe now
driver.verify_connectivity()
print(f"{driver._closed}, {len(driver._pool.connections}") # True, 1
# driver has unclosed resources
del driver # should generate an unclosed resource warning, but does not
My Environment
Python Version: 3.11
Driver Version: 5.10.0
Server Version and Edition: Neo4j Desktop, Neo4j DBMS 5.9.0
Operating System: Windows 10