Neo4j JavaScript Bolt driver ECONNRESET, buffer closed

399 Views Asked by At

I am sending around 300+ write and one read queries to the database via the official Neo4j javascript driver. Sometimes it's fast but sometimes I encounter this connection error called by driver.onError. Looking at the debug.log, it seems like sometimes application threads are blocked, and I get the second piece of log info below. Is it because I'm sending too many queries so it's throttled? Any tips what is causing this? Thanks a lot!

Console.log:

Driver instantiation failed. Error: Error: read ECONNRESET
{ Error: read ECONNRESET
   at Neo4jError.Error (native)
   at new Neo4jError 
  (/...myproject/node_modules/neo4j-driver/lib/v1/error.js:76:132)
at newError 
  (/...myproject/node_modules/neo4j-driver/lib/v1/error.js:66:10)
at NodeChannel._handleConnectionError 
  (...myproject/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:328:41)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at emitErrorNT (net.js:1281:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9) code: 'ServiceUnavailable' }

debug.log:

Failed to write response to driver Cannot write to buffer when closed
java.io.IOException: Cannot write to buffer when closed 
at org.neo4j.bolt.v1.transport.ChunkedOutput.ensure(ChunkedOutput.java:163)
at org.neo4j.bolt.v1.transport.ChunkedOutput.writeShort(ChunkedOutput.java:94)
at org.neo4j.bolt.v1.packstream.PackStream$Packer.packStructHeader(PackStream.java:427)
at org.neo4j.bolt.v1.messaging.BoltResponseMessageWriter.onFailure(BoltResponseMessageWriter.java:91)
at org.neo4j.bolt.v1.messaging.MessageProcessingHandler.publishError(MessageProcessingHandler.java:46)
at org.neo4j.bolt.v1.messaging.MessageProcessingHandler.onFinish(MessageProcessingHandler.java:107)
at org.neo4j.bolt.v1.runtime.BoltStateMachine.after(BoltStateMachine.java:102)
at org.neo4j.bolt.v1.runtime.BoltStateMachine.run(BoltStateMachine.java:198)
at org.neo4j.bolt.v1.messaging.BoltMessageRouter.lambda$onRun$3(BoltMessageRouter.java:80)
at org.neo4j.bolt.v1.runtime.concurrent.RunnableBoltWorker.execute(RunnableBoltWorker.java:130)
at org.neo4j.bolt.v1.runtime.concurrent.RunnableBoltWorker.executeBatch(RunnableBoltWorker.java:123)
at org.neo4j.bolt.v1.runtime.concurrent.RunnableBoltWorker.run(RunnableBoltWorker.java:96)
at java.lang.Thread.run(Thread.java:745)
0

There are 0 best solutions below