Skip to content

[PY3] "Failed to read from defunct connection" when sending bytes #147

@tardyp

Description

@tardyp
driver = GraphDatabase.driver(url, auth=basic_auth(*auth))
with driver.session() as session:
    with session.begin_transaction() as tx:
        tx.run("CREATE (a:Person $map)", map=dict(bytes=b"xx"))

crashes with :

Traceback (most recent call last):
  File "test.py", line 10, in <module>
    tx.run("CREATE (a:Person $map)", map=dict(bytes=b"xx"))
  File ".venv/lib/python3.6/site-packages/neo4j/v1/api.py", line 492, in __exit__
    self.close()
  File ".venv/lib/python3.6/site-packages/neo4j/v1/api.py", line 562, in close
    self.sync()
  File ".venv/lib/python3.6/site-packages/neo4j/v1/api.py", line 534, in sync
    self.session.sync()
  File ".venv/lib/python3.6/site-packages/neo4j/v1/api.py", line 331, in sync
    detail_count, _ = self._connection.sync()
  File ".venv/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 325, in sync
    detail_delta, summary_delta = self.fetch()
  File ".venv/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 255, in fetch
    self._receive()
  File ".venv/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 290, in _receive
    raise self.Error("Failed to read from defunct connection {!r}".format(self.server.address))
neo4j.exceptions.ServiceUnavailable: Failed to read from defunct connection Address(host='10.102.165.124', port=29627)

This confused me a lot, before I found out it is because of the bytes.
It's okay to only accept string, but I could have used some better erroring

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions