neo4j / neo4j-python-driver

Neo4j Bolt driver for Python
https://neo4j.com/docs/api/python-driver/current/
Other
898 stars 186 forks source link

Getting error despite closing driver using graph._driver.close() #1085

Closed rogerbarretocode closed 2 months ago

rogerbarretocode commented 2 months ago

i am using neo4j with langchain i have closed the driver but with logging enabled getting the following error . my python version is 3.9

[DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,049 [#0000] : close [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,049 [#A408] C: GOODBYE [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,050 [#A408] C: [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,050 [#A410] C: GOODBYE [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,050 [#A410] C: driver closed [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,182 [#0000] : close [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,182 [#A41C] C: GOODBYE [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,182 [#A41C] _: error: SSLError(0, 'Underlying socket connection gone (ssl.c:2411)') [ERROR ] MainThread(140019755107392) 2024-08-13 03:42:12,182 Failed to write data to connection ResolvedIPv4Address(('34.124.169.171', 7687)) (ResolvedIPv4Address(('34.124.169.171', 7687))) [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,182 [#A41C] : ignoring failed close SessionExpired("Failed to write data to connection ResolvedIPv4Address(('34.124.169.171', 7687)) (ResolvedIPv4Address(('34.124.169.171', 7687)))") [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,182 [#A41C] C: [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,182 [#A420] C: GOODBYE [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,182 [#A420] _: error: SSLError(0, 'Underlying socket connection gone (ssl.c:2411)') [ERROR ] MainThread(140019755107392) 2024-08-13 03:42:12,183 Failed to write data to connection IPv4Address(('a164f0c4.databases.neo4j.io', 7687)) (ResolvedIPv4Address(('34.124.169.171', 7687))) [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,183 [#A420] : ignoring failed close SessionExpired("Failed to write data to connection IPv4Address(('a164f0c4.databases.neo4j.io', 7687)) (ResolvedIPv4Address(('34.124.169.171', 7687)))") [DEBUG ] MainThread(140019755107392) 2024-08-13 03:42:12,183 [#A420] C:

robsdedude commented 2 months ago

Hi and thanks for reaching out.

There's nothing to worry about here. To quote the API docs:

The driver offers logging for debugging purposes. It is not recommended to enable logging for anything other than debugging. For instance, if the driver is not able to connect to the database server or if undesired behavior is observed.

This includes messages logged on WARNING level or higher. They are logged to help understand what is going on inside the driver. All relevant information is passed through return values, raised exceptions, warnings, etc. The logs are not the right place to look for actionable information.

As you can see the next log line states

ignoring failed close

The lower levels of the driver experienced an error namely that a pooled connection broke/got closed. However, there are more layers than just plain connectivity in the driver. Those might decide to either retry or ignore (as in this case) the error later on.

If you have questions, please feel free to keep commenting.