Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Client triggered an unexpected error" when loading empty CSV file #9130

Closed
also opened this issue Apr 1, 2017 · 2 comments
Closed

"Client triggered an unexpected error" when loading empty CSV file #9130

also opened this issue Apr 1, 2017 · 2 comments

Comments

@also
Copy link

also commented Apr 1, 2017

Running LOAD CSV WITH HEADERS with an empty CSV file causes an unexpected, unrecoverable error.

Neo4j Version: 3.1.3
Operating System: macOS 10.12.3
API: Cypher

Steps to reproduce

Run this in cypher-shell:

// assert correct line count
LOAD CSV WITH HEADERS FROM "file:///path/to/empty.csv" AS line
RETURN count(*);

empty.csv is an empty (0 byte) file.

Expected behavior

An error like "Invalid CSV" is returned. The error is recoverable in the client session, and the server does not log an exception.

Actual behavior

The cypher-shell session shows this error, and is no longer usable:

next on empty iterator
Exception in thread "Thread-0" org.neo4j.driver.v1.exceptions.ClientException: Cannot run more statements in the current session as an unrecoverable error has happened. Please close the current session and re-run your statement in a new session.
        at org.neo4j.driver.internal.NetworkSession.ensureNoUnrecoverableError(NetworkSession.java:274)
        at org.neo4j.driver.internal.NetworkSession.reset(NetworkSession.java:132)
        at org.neo4j.shell.state.BoltStateHandler.reset(BoltStateHandler.java:169)
        at org.neo4j.shell.CypherShell.reset(CypherShell.java:183)
        at org.neo4j.shell.CypherShell$1.run(CypherShell.java:190)

This is logged in the server's debug.log:

2017-04-01 18:28:17.784+0000 ERROR [o.n.b.v.r.ErrorReporter] Client triggered an unexpected error [UnknownError]: next on empty iterator. See debug.log for more details, reference a937cd46-55dd-44c6-b91a-ab0745c8cb90.
2017-04-01 18:28:17.784+0000 ERROR [o.n.b.v.r.ErrorReporter] Client triggered an unexpected error [UnknownError]: next on empty iterator, reference a937cd46-55dd-44c6-b91a-ab0745c8cb90. next on empty iterator
java.util.NoSuchElementException: next on empty iterator
	at scala.collection.Iterator$$anon$2.next(Iterator.scala:39)
	at scala.collection.Iterator$$anon$2.next(Iterator.scala:37)
	at org.neo4j.cypher.internal.compiler.v3_1.spi.CSVResources$$anon$1.next(CSVResources.scala:101)
	at org.neo4j.cypher.internal.compiler.v3_1.spi.CSVResources$$anon$1.next(CSVResources.scala:79)
	at org.neo4j.cypher.internal.compiler.v3_1.pipes.LoadCSVPipe$$anonfun$internalCreateResults$1.apply(LoadCSVPipe.scala:111)
	at org.neo4j.cypher.internal.compiler.v3_1.pipes.LoadCSVPipe$$anonfun$internalCreateResults$1.apply(LoadCSVPipe.scala:103)
	at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
	at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
	at scala.collection.Iterator$class.foreach(Iterator.scala:893)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
	at org.neo4j.cypher.internal.compiler.v3_1.pipes.EagerAggregationPipe.internalCreateResults(EagerAggregationPipe.scala:101)
	at org.neo4j.cypher.internal.compiler.v3_1.pipes.PipeWithSource.createResults(Pipe.scala:131)
	at org.neo4j.cypher.internal.compiler.v3_1.pipes.PipeWithSource.createResults(Pipe.scala:128)
	at org.neo4j.cypher.internal.compiler.v3_1.executionplan.DefaultExecutionResultBuilderFactory$ExecutionWorkflowBuilder.createResults(DefaultExecutionResultBuilderFactory.scala:98)
	at org.neo4j.cypher.internal.compiler.v3_1.executionplan.DefaultExecutionResultBuilderFactory$ExecutionWorkflowBuilder.build(DefaultExecutionResultBuilderFactory.scala:68)
	at org.neo4j.cypher.internal.compiler.v3_1.executionplan.InterpretedExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:164)
	at org.neo4j.cypher.internal.compiler.v3_1.executionplan.InterpretedExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:148)
	at org.neo4j.cypher.internal.compiler.v3_1.executionplan.InterpretedExecutionPlanBuilder$$anon$1.run(ExecutionPlanBuilder.scala:123)
	at org.neo4j.cypher.internal.compatibility.CompatibilityFor3_1$ExecutionPlanWrapper$$anonfun$run$1.apply(CompatibilityFor3_1.scala:277)
	at org.neo4j.cypher.internal.compatibility.CompatibilityFor3_1$ExecutionPlanWrapper$$anonfun$run$1.apply(CompatibilityFor3_1.scala:275)
	at org.neo4j.cypher.internal.compatibility.exceptionHandlerFor3_1$runSafely$.apply(CompatibilityFor3_1.scala:192)
	at org.neo4j.cypher.internal.compatibility.CompatibilityFor3_1$ExecutionPlanWrapper.run(CompatibilityFor3_1.scala:275)
	at org.neo4j.cypher.internal.PreparedPlanExecution.execute(PreparedPlanExecution.scala:26)
	at org.neo4j.cypher.internal.ExecutionEngine.execute(ExecutionEngine.scala:107)
	at org.neo4j.cypher.internal.javacompat.ExecutionEngine.executeQuery(ExecutionEngine.java:59)
	at org.neo4j.bolt.v1.runtime.TransactionStateMachineSPI$1.start(TransactionStateMachineSPI.java:135)
	at org.neo4j.bolt.v1.runtime.TransactionStateMachine$State$1.run(TransactionStateMachine.java:187)
	at org.neo4j.bolt.v1.runtime.TransactionStateMachine.run(TransactionStateMachine.java:77)
	at org.neo4j.bolt.v1.runtime.BoltStateMachine$State$2.run(BoltStateMachine.java:396)
	at org.neo4j.bolt.v1.runtime.BoltStateMachine.run(BoltStateMachine.java:196)
	at org.neo4j.bolt.v1.messaging.BoltMessageRouter.lambda$onRun$3(BoltMessageRouter.java:80)
	at org.neo4j.bolt.v1.runtime.concurrent.RunnableBoltWorker.execute(RunnableBoltWorker.java:135)
	at org.neo4j.bolt.v1.runtime.concurrent.RunnableBoltWorker.run(RunnableBoltWorker.java:89)
	at java.lang.Thread.run(Thread.java:745)
@spacecowboy
Copy link
Contributor

Thanks for the report @also

This is indeed a bug.

@systay
Copy link
Contributor

systay commented Apr 11, 2017

Fixed here: #9183

@systay systay closed this as completed Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants