1
votes

I'm experiencing 500 Internal Server Error occasionally when performing concurrent writes to Neo4j. Query example below.

MATCH (u1:User {id:{id1}})
MATCH (u2:User {id:{id2}})
MERGE (u1)-[:FOLLOWS]->(u2)

In case of very popular user you can experience high number of concurrent relationship creations for the u2 node.

At the momement I'm explicitly handling DeadlockDetectedException and have a retry logic in place. But from time to time I'm getting 500 from the server with response body below.

 <html>
     <head><title>500 Internal Server Error</title></head>
     <body bgcolor="white">
         <center><h1>500 Internal Server Error</h1></center>
         <hr><center>nginx</center>
      </body>
 </html>

Which gives me no clue what happened on the server. If I handle it and perform a retry everything works as expected. But this looks pretty dodgy as I basically guessing that in this particular case deadlock happened which might be wrong and unrelated to the actual server error.

1
The strange thing is that you get a html response from nginx. Is it the real http response from neo4j ? - Christophe Willemsen
@christophe-willemsen I'm using .net Neo4Client as a driver. My understanding (from the client source) this html returned as a http response reason phrase from neo4j. - drgraduss

1 Answers

0
votes

This issue was related to our ngnix box configuration which gave generic 500 in some occasions instead of propagating DeadlockDetectedException.