Neo4J Crashes due to Memory out of exception


(Rasheed) #1


We have built a Proof of Concept (PoC) application which uses Neo4J v3.0 community edition as Graph Database. The server is Windows 2012 R2 – Data Center edition with 16 GB RAM. When the application is in use, it consistently crashes due to out of memory exception. The only way to recover from this by restarting the neo4J services. This exception consistency happens when the Neo4J memory usage is reaching around 4 GB.

We have tried increasing the heap size to 8GB as per the documentation but it does not help. The application still crashes when the heap size reaches 4 GB. What are we missing here? Because of this issue, our customers are losing hopes on Neo4J as the documented configuration does not seem to work. Any help to resolve this issue would be greatly appreciated.

Best, Rasheed

(Andrew Bowman) #2

For one, 3.0 is a rather old version, and (assuming you're on 3.0.0) as it was the first major release for 3.0, it's bound to have more bugs than most other releases. We do not recommend using this version.

At the very least, you should use the latest patch version for the minor version you decide to use. 3.4.7 is the latest version currently, so it's 4 minor versions ahead of 3.0. There have been significant improvements, features, and bug fixes since 3.0. Please upgrade.

With the newer versions is a tool you can use to get a memory recommendation for what values to use for heap and pagecache. Please use this to set your value, though you may want to review the memory configuration page in the docs.

(Andrew Bowman) #3

Once you're on a newer version, and have your memory configured correctly (Neo4j does like memory, so if you can spare more, we'd recommend it), if you're still having memory issues then you may want to profile your queries and get advice for streamlining them, as inefficient queries may use up much more memory than is needed.

(Rasheed) #4

Thank you very much for your valuable inputs. We will try upgrading and try this out.

(Rasheed) #5

Hello Andrew,

Thanks for your feedback. We have upgraded neo4J and the heap memory issue is resolved. Now we are running a test by simulating 1000 query requests. The memory is stable unlike earlier, however, the tomcat server crashes with the following error:

2018-10-03 11:21:22.468+0000 ERROR [o.n.b.t.p.HouseKeeper] Fatal error occurred when handling a client connection: [id: 0x7ceb59a2, L:/ - R:/] An existing connection was forcibly closed by the remote host An existing connection was forcibly closed by the remote host

at Method)





at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(

at io.netty.buffer.AbstractByteBuf.writeBytes(







at io.netty.util.concurrent.SingleThreadEventExecutor$


Please let us know if you any inputs to resolve this issue. Appreciate your assistance.

(Andrew Bowman) #6

There's a github thread that might be related here.

You may also want to double check that you are handling transactions and sessions properly in your code, using try-with-resources blocks to ensure proper cleanup of both.