cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Neo4j Error: connections forcibly closed by remote host

Adrian_K
Node Link

Hello dear community,

first of all I'm new to Neo4j, so please excuse if there is any misunderstanding. I'm using Neo4j 4.0 and currently writing into a local database with the java driver. The data I want to write needs several days to process, but after about 2 days the following error appears in the log (one time for every running thread):

2020-04-24 14:21:45.728+0000 ERROR [o.n.b.t.p.HouseKeeper] Fatal error occurred when handling a client connection: [id: 0x442a10af, L:/127.0.0.1:7687 ! R:/127.0.0.1:52877] An existing connection was forcibly closed by the remote host
java.io.IOException: An existing connection was forcibly closed by the remote host
at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:113)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:58)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:408)
at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:930)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:354)
at io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:897)
at io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1372)
at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:750)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:765)
at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1104)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:834)

Previously written data was successfully written into the database, so I expect there to be no wrong usage of driver, session nor transaction. Does somebody have a clue what happened here? I've already searched the web and community and couldn't find any useful information for this specific problem.
I thought there might be some recycle process by neo4j, closing the connections after a time... If so, is there a way to catch this exception in java and repeat the Transaction by reestablishing the connection?

Thank you soo much in advance, this really gives me some headache.

All the best
Adrian

2 REPLIES 2

Hi, I have the same issue. I use spring.data.neo4j.** in application.properties. My Neo4j is hosted on a remote vm. Did you solve this problem now? Thanks

Hey,
sry for the late reply... In the meanwhile I got myself familar with Neo4j and optimized my code. Unfortunately I can't tell what the error was at last, but with the introduction of indexing and parametrized queries the error didn't appear again. Hopefully this could help somehow!
Best wishes