neo4j / neo4j-python-driver

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

When pool connection is not heath, the connection.close() sometime will raise an exception. #1056

Closed cnkailyn closed 1 month ago

cnkailyn commented 3 months ago

Backgroud: I got an issue raised from neo4j: this this the exception logs: image image

Then I checked the source code here: image

The direct issue is the connection is not health, maybe the TCP have already closed, but we still call connection.close(), then it raise that 'RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x56126bcdf100>; the handler is closed'.

there should add a try for connection.close() or add some conditions like: if not conncetion.tcp.closed: conncetion.close()

robsdedude commented 2 months ago

Hi and thanks for the bug report. It'd be a great help for me if you could share some extra information with me so that I can understand the problem in more detail:

robsdedude commented 2 months ago

Hello again @cnkailyn :wave:

Can you please share the requested information so that I can start investigating?

robsdedude commented 1 month ago

I'll close the issue now.

I've not heard back in over a month and I suspect that this is rather a bug in uvloop that claims to be a drop-in replacement for asyncio but fails to throw the same exceptions under the same conditions.

Please feel free to keep commenting if you have further questions. Should this turn out to be a bug in the driver, I'm happy to re-open the issue.