neo4j-python-driver icon indicating copy to clipboard operation
neo4j-python-driver copied to clipboard

"SessionExpired: Failed to read from defunct connection " when using Python driver > v5.27.0

Open Ramya2801 opened this issue 1 month ago • 1 comments

I’m currently using Neo4j database 5.26.4 with the official Python driver 5.27.0 and Python 3.10.12.

When I upgrade the driver to any version beyond 5.27.0, I start getting intermittent SessionExpired errors during the Bolt handshake:

neo4j.exceptions.SessionExpired: Failed to read from defunct connection

The same issue occurs for both:

  • GraphDatabase (sync) , AsyncGraphDatabase (async)
  • Neomodel db (sync) , AsyncDatabase (async)

With version 5.27.0, the connection is stable. With newer driver versions, the connection sometimes doesn’t establish successfully with the error above.

Environment details:

  • Python: 3.10.12,
  • OS: Ubuntu 22.04,
  • Database: Neo4j 5.26.4 ,
  • Bolt protocol: (5, 7)

Has anyone else faced similar intermittent connection failures with driver versions after 5.27.0? Any suggestions that help stabilize the connection would be appreciated.

Thanks.

Ramya2801 avatar Oct 28 '25 09:10 Ramya2801

Hi and thanks for reaching out. Could you share driver debug logs that allow me to compare a successful run on 5.26.4 with an unsuccessful one on 5.27.0.

robsdedude avatar Oct 28 '25 16:10 robsdedude