0

I am using Neo4j 2.2.1 and Spring Data Neo4j 4.0.0 and I am trying to import a timetree-like graph (with next, first, last, and child relationships), but with only 2 levels. I save at the root object and I got the following exception (due to the huge size, I omitted much of the repeating part in the exception):

org.neo4j.ogm.session.result.ResultProcessingException: Failed to execute request: {"statements":[{"statement":"CREATE (_1:`Trace`{_1_props}), 
...
...
        at org.neo4j.ogm.session.request.DefaultRequest.execute(DefaultRequest.java:90)
        at org.neo4j.ogm.session.request.SessionRequestHandler.execute(SessionRequestHandler.java:94)
        at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:66)
        at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:375)
        at org.springframework.data.neo4j.repository.GraphRepositoryImpl.save(GraphRepositoryImpl.java:101)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:452)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:437)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:409)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy42.save(Unknown Source)
        at de.rwthaachen.service.core.EpisodeServiceImpl.loadEpisodeVersionDataTest(EpisodeServiceImpl.java:141)
        at sampleapp.EpisodeLauncher.main(EpisodeLauncher.java:70)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
    Caused by: org.apache.http.client.HttpResponseException: Server Error
        at org.neo4j.ogm.session.request.DefaultRequest.execute(DefaultRequest.java:77)
        ... 27 more

This is the function in which I insert the data:

public void loadEpisodeVersionDataTest(String projectName, Long timestampOfEpisodeVersion, LinkedHashSet<ExecutionRecord> executionRecords)
    {
        Long episodeNodeId = timeTreeService.getEpisodeVersionNodeId(projectName, timestampOfEpisodeVersion);
        EpisodeVersion episodeVersion = episodeVersionRepository.findOne(episodeNodeId);

        if(episodeVersion.getTraces() == null)
        {
            episodeVersion.contains(new LinkedHashSet<Trace>());
            Trace firstTrace = new Trace(0);
            episodeVersion.addTrace(firstTrace);
            episodeVersion.first(firstTrace);
            episodeVersion.last(firstTrace);
        }

        HashMap<String, Filter> filterMatchingStringToFilterMap = new HashMap<String, Filter>();
        for(Filter filter : filterRepository.getFiltersByFilterVersionChangeId(episodeVersion.getFilterVersionChange().getId()))
        {
            filterMatchingStringToFilterMap.put(filter.getMatchingString(), filter);
        }

        Iterator<ExecutionRecord> executionRecordIterator = executionRecords.iterator();
        ExecutionRecord previousExecutionRecord = episodeVersion.getLastTrace().getLastExecutionRecord();
        while(executionRecordIterator.hasNext())
        {
            ExecutionRecord executionRecord = executionRecordIterator.next();

            executionRecord.callerMappedOn(filterMatchingStringToFilterMap.get(executionRecord.getCallerFilterMatchingString()));
            executionRecord.calleeMappedOn(filterMatchingStringToFilterMap.get(executionRecord.getCalleeFilterMatchingString()));

            if(executionRecord.getTraceSequenceNumber() != episodeVersion.getLastTrace().getTraceSequenceNumber())
            {
                Trace newTrace = new Trace(executionRecord.getTraceSequenceNumber());
                newTrace.nextOf(episodeVersion.getLastTrace());
                episodeVersion.addTrace(newTrace);
                episodeVersion.last(newTrace);
            }

            if(episodeVersion.getLastTrace().getExecutionRecords() == null)
            {
                episodeVersion.getLastTrace().contains(new LinkedHashSet<ExecutionRecord>());
                episodeVersion.getLastTrace().first(executionRecord);
            }

            episodeVersion.getLastTrace().addExecutionRecord(executionRecord);
            executionRecord.nextOf(previousExecutionRecord);
            previousExecutionRecord = executionRecord;
            episodeVersion.getLastTrace().last(executionRecord);
        }

        episodeVersionRepository.save(episodeVersion);
    }

What does this exception means? When I debug my code, the object definition is as intended. Thank you in advance and your suggestion would be really appreciated!

EDIT

So, I have managed to make the previous exception gone. But now I get another exception like below.

java.lang.OutOfMemoryError: Java heap space\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:366)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.matchers.MemoMismatchesMatcher.match(MemoMismatchesMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.ZeroOrMoreMatcher.match(ZeroOrMoreMatcher.java:39)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.ZeroOrMoreMatcher.match(ZeroOrMoreMatcher.java:39)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.parserunners.BasicParseRunner.run(BasicParseRunner.java:72)\r\n\tat org.parboiled.parserunners.ReportingParseRunner.runBasicMatch(ReportingParseRunner.java:86)\r\n\tat org.parboiled.parserunners.ReportingParseRunner.run(ReportingParseRunner.java:66)\r\n\tat org.parboiled.scala.parserunners.ReportingParseRunner.run(ReportingParseRunner.scala:34)\r\n\tat org.neo4j.cypher.internal.compiler.v2_2.parser.Base$class.parseOrThrow(Base.scala:117)\r\n\tat org.neo4j.cypher.internal.compiler.v2_2.parser.CypherParser.parseOrThrow(CypherParser.scala:27)\r\n\tat org.neo4j.cypher.internal.compiler.v2_2.parser.CypherParser.parse(CypherParser.scala:34)\r\n\tat org.neo4j.cypher.internal.compiler.v2_2.CypherCompiler.prepareQuery(CypherCompiler.scala:126)\r\n\tat org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$$anon$2$$anonfun$3.apply(CompatibilityFor2_2.scala:154)\r\n\tat org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$$anon$2$$anonfun$3.apply(CompatibilityFor2_2.scala:154)\r\n\tat scala.util.Try$.apply(Try.scala:161)\r\n\tat org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$$anon$2.<init>(CompatibilityFor2_2.scala:154)\r\n\tat org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$class.produceParsedQuery(CompatibilityFor2_2.scala:153)\r\n\tat org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2Cost.produceParsedQuery(CompatibilityFor2_2.scala:326)\r\n\tat org.neo4j.cypher.internal.CypherCompiler.parseQuery(CypherCompiler.scala:81)\r\n\tat org.neo4j.cypher.ExecutionEngine$$anonfun$org$neo4j$cypher$ExecutionEngine$$parsePreParsedQuery$1.apply(ExecutionEngine.scala:116)\r\n\tat org.neo4j.cypher.ExecutionEngine$$anonfun$org$neo4j$cypher$ExecutionEngine$$parsePreParsedQuery$1.apply(ExecutionEngine.scala:116)\r\n\tat org.neo4j.cypher.internal.LRUCache.getOrElseUpdate(LRUCache.scala:34)\r\n\tat org.neo4j.cypher.ExecutionEngine.org$neo4j$cypher$ExecutionEngine$$parsePreParsedQuery(ExecutionEngine.scala:116)\r\n\tat org.neo4j.cypher.ExecutionEngine.parseQuery(ExecutionEngine.scala:112)\r\n\tat org.neo4j.cypher.internal.ServerExecutionEngine.isPeriodicCommit(ServerExecutionEngine.scala:34)\r\n\tat org.neo4j.cypher.javacompat.internal.ServerExecutionEngine.isPeriodicCommit(ServerExecutionEngine.java:72)\r\n\tat org.neo4j.server.rest.transactional.TransactionHandle.selectExecutionStrategy(TransactionHandle.java:189)\r\n\tat org.neo4j.server.rest.transactional.TransactionHandle.commit(TransactionHandle.java:133)\r\n\tat org.neo4j.server.rest.web.TransactionalService$2.write(TransactionalService.java:211)\r\n\tat com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71)\r\n\tat com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57)\r\n\tat com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)\r\n\tat com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)\r\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)\r\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\r\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:800)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.neo4j.server.rest.dbms.AuthorizationFilter.doFilter(AuthorizationFilter.java:120)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:497)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\r\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)\r\n\tat org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: java.lang.OutOfMemoryError: Java heap space\r\n\tat java.util.HashMap.resize(HashMap.java:580)\r\n\tat java.util.HashMap.addEntry(HashMap.java:879)\r\n\tat java.util.HashMap.put(HashMap.java:505)\r\n\tat java.util.HashSet.add(HashSet.java:217)\r\n\tat org.parboiled.MatcherContext.memoizeMismatch(MatcherContext.java:312)\r\n\tat org.parboiled.matchers.MemoMismatchesMatcher.match(MemoMismatchesMatcher.java:44)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.matchers.MemoMismatchesMatcher.match(MemoMismatchesMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n\tat org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)\r\n\tat org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)\r\n\tat org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)\r\n"}]}
    at org.neo4j.ogm.session.response.JsonResponse.parseErrors(JsonResponse.java:132)
    at org.neo4j.ogm.session.response.JsonResponse.parseColumns(JsonResponse.java:109)
    at org.neo4j.ogm.session.response.JsonResponse.initialiseScan(JsonResponse.java:53)
    at org.neo4j.ogm.session.response.RowModelResponse.initialiseScan(RowModelResponse.java:60)
    at org.neo4j.ogm.session.response.RowModelResponse.<init>(RowModelResponse.java:34)
    at org.neo4j.ogm.session.response.SessionResponseHandler.updateObjects(SessionResponseHandler.java:77)
    at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:67)
    at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:41)
    at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:370)
    at org.springframework.data.neo4j.repository.GraphRepositoryImpl.save(GraphRepositoryImpl.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:452)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:437)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:409)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
    at com.sun.proxy.$Proxy42.save(Unknown Source)
    at de.rwthaachen.service.core.EpisodeServiceImpl.loadEpisodeVersionDataTest(EpisodeServiceImpl.java:141148)
    at sampleapp.EpisodeLauncher.main(EpisodeLauncher.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.apache.http.client.HttpResponseException: Server Error
    at org.neo4j.ogm.session.request.DefaultRequest.execute(DefaultRequest.java:77)
    ... 27 more
Peter Sie
  • 175
  • 11
  • Hard to say with this info. Could you share the code of the root object that produces this exception when saved? (EpisodeServiceImpl.java:141 is a call to save, right?) – Luanne Jun 01 '15 at 13:51
  • Hi Luanne, thanks for your quick response. I have managed to fix the previous exception, but then I get another exception (I have edited my post). In the new exception, there is outOfMemory error. The graph that I try to save is actually not big. – Peter Sie Jun 01 '15 at 14:59
  • What's your heap size? Can you set debug on for org.neo4j.org and check if this line is present and what it reports- number of objects:. Are you using a RemoteServer or InProcessServer? Also what happens if you save episodeVersion in each iteration of the while loop? – Luanne Jun 02 '15 at 05:21
  • Now I have found a workaround by saving the objects under the episodeVersion object and it works (except the fact that it's rather slow. just importing less than 100 nodes of dummy data takes around 8 seconds?? The actual data can reach hundreds of thousands...) In my implementation, I use LinkedHashSet because I want to retain the order of my objects. But, I find a GraphMapping problem that says it can't map from LinkedHashSet to ArrayList. Do you know what should I do to cope with this? – Peter Sie Jun 02 '15 at 11:35
  • From the logs that are printed in the console of my IDE, I see so many commit requests, but I actually call the .save method only once at the end. – Peter Sie Jun 02 '15 at 11:47
  • And now when I try to import 1000 nodes, it gets me a java.lang.StackOverflowError. – Peter Sie Jun 02 '15 at 11:49
  • I am using RemoteServer. With the previous approach, if I call save in each iteration, then it works. But I don't want to call the save multiple times like that. – Peter Sie Jun 02 '15 at 11:51
  • How did you fix your initial exception? I'm getting the same exception... – Nachshon Schwartz Oct 21 '15 at 09:35

3 Answers3

2

SDN 4 isn't really intended to be used to batch import your objects into Neo4j. Its an Object Graph Mapping framework for general purpose Java applications, not a batch importer (which brings its own specific set of problems to the table). Some of the design decisions to support the intended use-case for SDN run contrary to what you would do if you were trying to design a purpose-built ETL. We are also constrained by the performance of Neo4j's HTTP Transactional endpoint, which although by no means slow in absolute terms, cannot hope to compete with the Batch Inserter for example.

There are some improvements to performance we will be making in the future and when the new binary protocol for Neo4j is released (2.3), we will be plugging that in as our transfer protocol. We expect this to improve transfer speeds to and from the database by at least an order of magnitude. However, please don't expect these changes to radically alter the behavioural characteristics of SDN 4. While a future version might be able load a few thousand nodes much faster than it can currently, it still won't be an ETL tool, and I wouldn't expect it to be used as such.

Vince
  • 2,181
  • 13
  • 16
  • To be honest, I really regret the fact that I knew this really late. Before deciding to migrate to SDN4, I had done my implementation with Embedded API and I thought that the SDN version 4 would compete the performance of Embedded API. For a more readable and concise code I chose to use SDN4. But, I think now I have to go back to Embedded API and leave my SDN4 project unused. Yeah, that's research.. – Peter Sie Jun 03 '15 at 11:12
  • Or, is there any way to integrate SDN4 usage with the Embedded API? If it's there, I would write the code of my batch importer in Embedded API and also reuse some parts from the SDN4. – Peter Sie Jun 03 '15 at 11:13
1

If you're constrained by memory, then saving regularly will help since SDN 4 persists what has changed. The multiple commits you see are parts of one running transaction.

On the LinkedHashSet issue, using the interface Setlike this

 Set<Foo> x = new LinkedHashSet<();
 ...
 public Set<Foo> getX() {}

should work.

Luanne
  • 19,145
  • 1
  • 39
  • 51
  • Thanks for your response. After I omit the comment of java heap size settings in the neo4j-wrapper.conf (which both have the value of 512), my code in the question works. And I also have tried your suggestion to put the save call inside the loop, but I don't gain any performance improvement. And still, when I import 1000 nodes, it takes like forever to insert and I get StackOverFlow error at the end. Would it be possible that the logging of INFOs cause the slow performance? How can I deactivate this logging, or at least just show me if errors, not infos? – Peter Sie Jun 02 '15 at 12:43
  • I doubt the logging would impact performance so adversely. You can set these – Luanne Jun 02 '15 at 13:15
  • I have added the StackOverFlow error in my post. I have no idea which side of my code that causes this. I get this when I try to import 1000 nodes with the relationships. – Peter Sie Jun 02 '15 at 18:07
  • I think I know the cause of this stackoverflow error. After adding nodes bit by bit, at some point, it gets stackoverflow error. The object that I save (episodeVersion) has myriad of children objects (Traces) and it gets error when it tries to identify the changes in that episodeVersion object because the SDN does too much recursion to find the changes. Do you have any suggestion how to cope with this? Thx in advance. – Peter Sie Jun 02 '15 at 19:23
  • 1
    This is a different issue, could you open up a new question and close this one please? Please also keep the original out of memory exception in the question to serve as a reference for others coming across this thread. Thanks – Luanne Jun 03 '15 at 03:52
0

After some hours of trial and error, finally I found that I need to limit my save depth level.

Previously, I didn't specify the depth level and the saved object was growing larger and larger as the insertion of its children also ran concurrently. So, after giving a depth of 1 on every save method, I finally get rid of the StackOverFlow error. And, by not saving regularly (I put all the objects in an ArrayList and save them all at the end), I get 1 minute performance gain for importing ca. 1000 nodes (with relationships).

Nevertheless, the performance is still not satisfying yet since I could import over 60,000 data in just less than 1 minute with my previous MongoDB implementation. I don't know if it is because of the SDN4 and if it could be faster with Embedded API. I'm really curious if anyone did any benchmarking on SDN4 and Embedded API.

Peter Sie
  • 175
  • 11