-
Notifications
You must be signed in to change notification settings - Fork 150
How to solve Neo4jError: read ECONNRESET #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @rjgmail88, Such errors happen when either network equipment or the database closes the connection. I think retrying the query/transaction is a good thing to do if errors are caused by the network equipment/stack. You could use transaction functions API which can retry with exponential backoff on such errors. More info and usage patterns can be found in the developer manual. Database might close connection because of unrecoverable errors (out of memory, protocol violation, etc). Could you please attach the database logs |
@rjgmail88 couple more questions:
|
@lutovich , sorry for the delayed response. I will be attaching log files soon.
2.Neo4j
|
I attached the logs. We are getting the below errors while creating connections. 2018-06-19 14:43:06.665+0000 ERROR [o.n.b.t.SocketTransportHandler] Fatal error occurred when handling a client connection: [id: 0x0b223092, L:/10.0.5.4:7687 - R:/13.84.153.1:58608] syscall:read(..) failed: Connection reset by peer |
@lutovich , log files have been posted. Please let us know if you can help. { Neo4jError: read ECONNRESET form above stack trace I'm confused if its Service unavailable error mentioned bellow. |
From my local instance of nodejs app I am seeing different stack trace for same scenario.
|
@rjgmail88 @ganeshchippada debug.log shows that it is definitely not the database closing all those connections. There are many "Connection reset by peer" errors in the log which most likely means that something in-between driver and database has closed the connection. Such connections appear to be broken for both driver and database. Does there exist a load balancer or a proxy server in your network? Provided Could you please also share the code that creates the driver and executes queries? It would be valuable to see which API is used for query execution ( |
Hi @lutovich , Does there exist a load balancer or a proxy server in your network?Ans:- No. We are using public Neo4j VM IP with Bolt url. Here is how we consume API's setup.js holds code to create and expose driver object. getGraphDriver()
consume of driver is in index.js file in getCampuData() where we run queries using session. We use promise way mentioned in the document.
One more think I would like to mention. I setup connection pool size to 10 yesterday and I was able to reproduce the error in local as well as from azure cloud app. So it might not re related to infrastructure. |
As mentioned in the doc here
I am still able to see Neo4jError: read ECONNRESET and retry isn't working with Transaction functions. |
Is there any way to find if ReTry happened ? |
Hi @rjgmail88, Your code with Right now there is no built-in way to log retries. We will add it to 1.7 version of the driver. You could insert logging of retries in the function itself: const session = driver.session();
let retryCount = 0;
const writeTxPromise = session.writeTransaction(tx => {
if (retryCount === 0) {
console.log('Executing query for the first time');
} else {
console.log('Retrying query: ' + retryCount);
}
retryCount++;
return tx.run('CREATE (a:Person {name: $name})', {'name': personName});
});
writeTxPromise.then(result => {
session.close();
if (result) {
console.log('Person created');
}
}); By default driver will rety for 30 seconds. This time is configurable via You can experience these errors even locally right? Could you please provide a reproducer application that I can run locally? |
Yes, I can reproduce locally as well. I have refactored my code to use transaction api's. I will test for couple days and see how it goes. If that fixes the issue we should be good. |
We are good on this. Thank you. |
Sorry to dig up an old thread -- is this now possible? Edit: found it, thanks: #380 |
Since we started using this driver we are getting following error frequently.
Is there any way to fix this ? We are using connectionPoolSize = 0 while creating driver. Also using nodejs promise way run the neo4j queries and doing session.close() every time.
The text was updated successfully, but these errors were encountered: