5

I'm trying to create a relatively small Neo4j db on a PC (or, more precisely, a MacBookPro 10.9.2, running Neo4j 2.1.0), consisting of 1400 CREATE statements. When I load the graph file via the terminal I get the following error message (the entire stacktrace is too long for Stackoverflow, but here is the first three lines of the error message and of the Caused By list):

Error occurred in server thread; nested exception is:     
java.lang.StackOverflowError
java.rmi.ServerError: Error occurred in server thread; nested exception is:     
java.lang.StackOverflowError
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:350)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)

...

Caused by: java.lang.StackOverflowError
at org.neo4j.cypher.internal.compiler.v2_1.ReattachAliasedExpressions$.apply(ReattachAliasedExpressions.scala:31)
at org.neo4j.cypher.internal.compiler.v2_1.ReattachAliasedExpressions$$anonfun$2.apply(ReattachAliasedExpressions.scala:36)
at org.neo4j.cypher.internal.compiler.v2_1.ReattachAliasedExpressions$$anonfun$2.apply(ReattachAliasedExpressions.scala:36)
at scala.Option.map(Option.scala:145)

I can load all 1400 create statements in separate files containing 300-Create statements, so my Cypher seems to be correct. How can I increase my stack size so that I can upload a larger Neo4j database? (I am creating the database out of a great whack of xml, and expect in the final analysis to have to have ~3000 nodes and ~4000 relationships).

CLKC
  • 53
  • 5
  • Please add the whole stacktrace. – Jens Jan 14 '15 at 06:12
  • 1
    Have you considered converting the XML to CSV and using `LOAD CSV`? – Dave Bennett Jan 14 '15 at 06:36
  • @Jens I've added the stacktrace – CLKC Jan 17 '15 at 23:55
  • If you just want to know how to increase the stack size: http://stackoverflow.com/questions/3700459/how-to-increase-the-java-stack-size – Stephen C Jan 18 '15 at 00:01
  • I've set -Xss515m, -Xmx4G, -Xms4G, -Xmn1G, but still no dice. Too much? Too little? – CLKC Jan 18 '15 at 00:40
  • I had the same problem happening. It was caused either by an extremely lengthy `x IN [...]` condition, or by the fact that that condition pushed the entire query over a certain length. This was the first time *ever* that increasing stack size was a fix for a `StackOverflowError`. This is probably still a bug worth fixing, recursion like this might not be desirable with large possible input sets. – Sander Verhagen Feb 07 '15 at 06:39
  • Thanks @SanderVerhagen. I am still a little jammed up but will post any additional fixes or work around I come across along the way. – CLKC Feb 08 '15 at 16:42
  • Because I was in a similar position a while ago (my whack was not xml, but some oddly formatted text files), I recommend creating proper CSV files out of your data whack and then using the neo4j-import tool for building a new database from the ground up. – manonthemat Sep 23 '15 at 23:21

1 Answers1

1

I know this is an older question, but I'll provide an answer for any future Googlers.

How can I increase my stack size so that I can upload a larger Neo4j database?

I had a similar issue with loading a large Cypher command file (also from within Java). I was able to get it to complete by increasing by JVM Stack size to 2 megabytes. The way to do this, is to add a configuration line for additional JVM options to the end of your neo4j.conf file:

#increasing stack size
dbms.jvm.additional=-Xss2M

My command file was about 2600 lines long, so your stack size may vary depending on the size of your file or number of commands.

Aaron
  • 55,518
  • 11
  • 116
  • 132