Neo4j Timeout error

Hi all, I’m running Neo4j 5.x on Ubuntu (Jetstream2 cluster) and keep hitting timeout and disconnect errors when running long Cypher queries via cypher-shell.

Example command: cypher-shell -a bolt://<public_ip>:7687 -u neo4j -p '' < queries.cypher Error: Connection to the database terminated. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings. Note that the default encryption setting has changed in Neo4j 4.0.

What I tried: Increased memory in
neo4j.conf: server.memory.heap.initial_size=3g
server.memory.heap.max_size=3g
server.memory.pagecache.size=12g
dbms.memory.transaction.total.max=4g
Checked logs (journalctl -u neo4j) → saw OutOfMemoryError: Java heap space Tried setting Bolt keep-alive configs, but some keys (like server.bolt.keep_alive_interval) aren’t recognized

My questions: What’s the correct way to tune keep-alive / timeout settings for very long-running queries in Neo4j 5.x? Should I adjust dbms.memory.transaction.total.max or increase heap further (I have ~30GB RAM available)?

Is there a better practice for running multi-hour queries via cypher-shell (batching, streaming results, etc.)? Logs snippet: java.lang.OutOfMemoryError: Java heap space Connection read timed out due to it taking longer than the server-supplied timeout value via configuration hint.

For context, I’m running on the Amazon dataset (~300M nodes, ~700M edges).

@prajwalv03

your conf/neo4j.conf settings of

server.memory.heap.initial_size=3g
server.memory.heap.max_size=3g
server.memory.pagecache.size=12g
dbms.memory.transaction.total.max=4g

are a bit odd in the min/max heap are set to 3g but yet you have set the max transaction heap usage of 4g? But if heap can only grow as large as 3g setting all transactions to consume 130% of heap doesnt seem prudent

Regarding next steps, even a poorly written query can consume all of heap and thus lead to an out of memory.

Multi-hour queries?

  • how large is your database? i.e. size of data/databases/<databaseName>
  • are your queries utilizing indexes where appropriate?