pythonneo4jneo4j-driver

Neo4j driver closes connection when executing query


I have a script that uses Neo4j for tracking user taste preferences on alcohol types. So, basically when a user sets his preferences via an API endpoint the response is buffered to Kafka and I pick it from there. I am getting the following error when trying to read/write to Neo4j via the neo4j python driver:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/ssl.py", line 787, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/lib/python2.7/ssl.py", line 657, in read
v = self.\_sslobj.read(len, buffer)
socket.error: \[Errno 104\] Connection reset by peer
Exception socket.error: error(104, 'Connection reset by peer') in 'neo4j.bolt.\_io.ChunkedInputBuffer.receive' ignored
INFO:UserSettingsProcessorProduction:2018-09-25 13:01:34 Type:<class 'neo4j.exceptions.ServiceUnavailable'> Filename:user_settings_processor.py Line:258 ERROR: Failed to write to closed connection Address(host='54.225.50.91', port=24786)

Strange is that I cannot reproduce it on local but I am getting it often while it is running in a Docker container. I read somewhere that it could be Docker configuration issue. If the container is private for an example or something like that. I deployed it via AWS / ECS(Elastic Container Service) and it is running on a EC2 instance which is Amazon Linux AMI. If you have any suggestions what may fix it I will be very thankful!

I will keep the thread updated if I find an answer also.


Solution

  • We decided to use GraphQL for communicating with Neo4j and this doesn't seem to be an issue any more. I couldn't find any solution or a clue why actually it is behaving like this, while working perfectly fine on my computer. The service is deployed on a docker container, using ECS.