Description
Issue by tolomaus
Saturday Sep 05, 2020 at 16:21 GMT
Originally opened as neo4j-contrib/neo4j-apoc-procedures#1652
Hi, I'm migrating my graph db from neo4j 3.5 to 4.1 but it looks like the apoc.cypher.runTimeboxed procedure is broken:
neo4j@neo4j> CREATE (n:Person { name: 'Andy', title: 'Developer' });
neo4j@neo4j> CREATE (n:Person { name: 'Andy', title: 'Developer' });
neo4j@neo4j> CREATE (n:Person { name: 'Andy', title: 'Developer' });
neo4j@neo4j> CREATE (n:Person { name: 'Andy', title: 'Developer' });
neo4j@neo4j> CREATE (n:Person { name: 'Andy', title: 'Developer' });
neo4j@neo4j> MATCH (n) RETURN n;
n
(:Person {name: "Andy", title: "Developer"})
(:Person {name: "Andy", title: "Developer"})
(:Person {name: "Andy", title: "Developer"})
(:Person {name: "Andy", title: "Developer"})
(:Person {name: "Andy", title: "Developer"})
neo4j@neo4j> call apoc.cypher.runTimeboxed("MATCH (n) RETURN n", null, 1000);
value
{n: (:Person {name: "Andy", title: "Developer"})}
org.neo4j.driver.exceptions.DatabaseException: The transaction has been closed.
at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:143)
at org.neo4j.driver.internal.InternalResult.blockingGet(InternalResult.java:128)
at org.neo4j.driver.internal.InternalResult.hasNext(InternalResult.java:64)
at org.neo4j.shell.prettyprint.SimpleOutputFormatter.formatAndCount(SimpleOutputFormatter.java:28)
at org.neo4j.shell.prettyprint.PrettyPrinter.format(PrettyPrinter.java:28)
at org.neo4j.shell.CypherShell.lambda$executeCypher$0(CypherShell.java:99)
at java.base/java.util.Optional.ifPresent(Optional.java:176)
at org.neo4j.shell.CypherShell.executeCypher(CypherShell.java:98)
at org.neo4j.shell.CypherShell.execute(CypherShell.java:81)
at org.neo4j.shell.cli.InteractiveShellRunner.runUntilEnd(InteractiveShellRunner.java:107)
at org.neo4j.shell.Main.runShell(Main.java:121)
at org.neo4j.shell.Main.startShell(Main.java:87)
at org.neo4j.shell.Main.main(Main.java:45)
Suppressed: org.neo4j.driver.internal.util.ErrorUtil$InternalExceptionCause
at org.neo4j.driver.internal.util.ErrorUtil.newNeo4jError(ErrorUtil.java:85)
at org.neo4j.driver.internal.async.inbound.InboundMessageDispatcher.handleFailureMessage(InboundMessageDispatcher.java:105)
at org.neo4j.driver.internal.messaging.v1.MessageReaderV1.unpackFailureMessage(MessageReaderV1.java:83)
at org.neo4j.driver.internal.messaging.v1.MessageReaderV1.read(MessageReaderV1.java:59)
at org.neo4j.driver.internal.async.inbound.InboundMessageHandler.channelRead0(InboundMessageHandler.java:83)
at org.neo4j.driver.internal.async.inbound.InboundMessageHandler.channelRead0(InboundMessageHandler.java:35)
at org.neo4j.driver.internal.shaded.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at org.neo4j.driver.internal.shaded.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at org.neo4j.driver.internal.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at org.neo4j.driver.internal.async.inbound.MessageDecoder.channelRead(MessageDecoder.java:47)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at org.neo4j.driver.internal.shaded.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at org.neo4j.driver.internal.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at org.neo4j.driver.internal.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at org.neo4j.driver.internal.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at org.neo4j.driver.internal.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at org.neo4j.driver.internal.shaded.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at org.neo4j.driver.internal.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:832)
I used a clean install of neo4j 4.1.1 + apoc 4.1.0.2 on both centos and mac and even spun up a neo4j Aura instance, all giving the same result.
The test only checks if the result count is higher than zero: https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/16581f3253f82e75506428dfd2a498346c6bfb1d/core/src/test/java/apoc/cypher/CypherTest.java#L180 maybe it doesnt need to hit the database again for this.
See also the following result:
neo4j@neo4j> call apoc.cypher.runTimeboxed("MATCH (n) RETURN n", null, 1000) YIELD value RETURN value.x;
value.x
NULL
NULL
NULL
NULL
NULL
so it looks like all five of the results are correctly found. Since I only want an non-existing property x it just returns NULLs and doesnt have to hit the database neither so avoiding the above error.