Closed istrel closed 6 years ago
Thanks for reporting. This looks like a bug.
@istrel Do you have any sample code that could help us reproduce the error?
@technige I've reduced to this sample script
import os
from neo4j.v1 import GraphDatabase, basic_auth
neo4j_addr = os.getenv("NEO4J_ADDR", "bolt+routing://<host>:7687")
neo4j_password = os.getenv("NEO4J_PASSWORD", "neo4j")
driver = GraphDatabase.driver(
neo4j_addr,
auth=basic_auth("neo4j", neo4j_password),
)
def do_iteration():
with driver.session() as session:
def increment_counter(tx):
tx.run("""
MERGE
(t:TestNode)
ON CREATE SET
t.counter = 0
SET
t.counter = t.counter + 1
""", {})
session.write_transaction(increment_counter)
for i in range(100000):
print(i)
do_iteration()
When I shut down leader I see the following:
...
500
501
Traceback (most recent call last):
File "test.py", line 25, in do_iteration
session.write_transaction(increment_counter)
File "/usr/local/lib/python3.6/site-packages/neo4j/__init__.py", line 701, in write_transaction
return self._run_transaction(WRITE_ACCESS, unit_of_work, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/neo4j/__init__.py", line 664, in _run_transaction
self._open_transaction(access_mode, metadata, timeout)
File "/usr/local/lib/python3.6/site-packages/neo4j/__init__.py", line 610, in _open_transaction
self._connect(access_mode)
File "/usr/local/lib/python3.6/site-packages/neo4j/__init__.py", line 367, in _connect
self._connection = self._acquirer(access_mode)
File "/usr/local/lib/python3.6/site-packages/neobolt/routing.py", line 425, in acquire
connection = self.acquire_direct(address) # should always be a resolved address
File "/usr/local/lib/python3.6/site-packages/neobolt/direct.py", line 575, in acquire_direct
connection = self.connector(address, error_handler=self.connection_error_handler)
File "/usr/local/lib/python3.6/site-packages/neo4j/__init__.py", line 255, in connector
return connect(address, **dict(config, **kwargs))
File "/usr/local/lib/python3.6/site-packages/neobolt/direct.py", line 937, in connect
raise last_error
File "/usr/local/lib/python3.6/site-packages/neobolt/direct.py", line 927, in connect
s = _connect(resolved_address, **config)
File "/usr/local/lib/python3.6/site-packages/neobolt/direct.py", line 793, in _connect
s.connect(resolved_address)
OSError: [Errno 51] Network is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 30, in <module>
do_iteration()
File "test.py", line 25, in do_iteration
session.write_transaction(increment_counter)
File "/usr/local/lib/python3.6/site-packages/neo4j/__init__.py", line 358, in __exit__
self.close()
File "/usr/local/lib/python3.6/site-packages/neo4j/__init__.py", line 391, in close
self.rollback_transaction()
File "/usr/local/lib/python3.6/site-packages/neo4j/__init__.py", line 643, in rollback_transaction
self._connection.rollback(on_success=metadata.update)
AttributeError: 'NoneType' object has no attribute 'rollback'
Tested 1.7.1 - it works! 🎉
Thank you very much!
Hi
I did not understand how it was fixed and what to do to recover from this error. Can you please explain more.
I am getting null connection trying to connect from neomodel for Django (https://pypi.org/project/django_neomodel/):
$ python3 manage.py install_labels Setting up indexes and constraints...
Found django_neomodel.DjangoNode ! Skipping class django_neomodel.DjangoNode is abstract Found qApp.models.Surah
Thank you
Prerequisites:
When we shutdown leader, we start facing such stack traces (
...
replaced parts of stack in our code);Here is some logs from neobolt logger captured immediately before exception:
Python libraries: neo4j==1.7.0 neobolt==1.7.0
Neo4j version: 3.4.7