Neo4j Randomly Terminating Connection While running gds algo

When i am running the knn algorithm, after few runs the connection is getting terminated automatically, I am having approx 4.5k nodes and 4.5k relationships.

Even i went through this topic “https://community.neo4j.com/t/neo4j-randomly-terminating-connection-with-spring-service/69358” and as per it, it mentioned to increase the heap memory size which i did and increased it to 8GB and run the algo again but still i face the same issue.

These are the logs from the debug.logs file at the time of error.

2025-10-24 11:15:43.017+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 98 of 100 :: Start
2025-10-24 11:15:43.017+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 98 of 100 100%
2025-10-24 11:15:43.017+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 98 of 100 :: Finished
2025-10-24 11:15:43.017+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 98 of 100 :: Start
2025-10-24 11:15:43.017+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 98 of 100 100%
2025-10-24 11:15:43.017+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 98 of 100 :: Finished
2025-10-24 11:15:43.017+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 98 of 100 :: Start
2025-10-24 11:15:43.044+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 98 of 100 100%
2025-10-24 11:15:43.044+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 98 of 100 :: Finished
2025-10-24 11:15:43.044+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 99 of 100 :: Start
2025-10-24 11:15:43.044+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 99 of 100 100%
2025-10-24 11:15:43.045+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 99 of 100 :: Finished
2025-10-24 11:15:43.045+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 99 of 100 :: Start
2025-10-24 11:15:43.045+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 99 of 100 100%
2025-10-24 11:15:43.045+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 99 of 100 :: Finished
2025-10-24 11:15:43.045+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 99 of 100 :: Start
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 99 of 100 100%
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 99 of 100 :: Finished
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 100 of 100 :: Start
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 100 of 100 100%
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 100 of 100 :: Finished
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 100 of 100 :: Start
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 100 of 100 100%
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 100 of 100 :: Finished
2025-10-24 11:15:43.071+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 100 of 100 :: Start
2025-10-24 11:15:43.098+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 100 of 100 100%
2025-10-24 11:15:43.098+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 100 of 100 :: Finished
2025-10-24 11:15:43.098+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Finished
2025-10-24 11:15:43.098+0000 INFO  [c.n.g.e.GraphDataScienceExtension] [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Finished
2025-10-24 11:15:48.382+0000 ERROR [o.n.b.p.c.h.HouseKeeperHandler] Fatal error occurred when handling a client connection: [id: 0x09e23e9e, L:/127.0.0.1:7687 - R:/127.0.0.1:59225]
java.net.SocketException: Connection reset
	at sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394) ~[?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426) ~[?:?]
	at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:255) ~[netty-buffer-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) ~[netty-buffer-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:356) ~[netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [netty-common-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.115.Final.jar:4.1.115.Final]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2025-10-24 11:15:48.382+0000 ERROR [o.n.b.p.c.h.HouseKeeperHandler] Fatal error occurred when handling a client connection: [id: 0x2019ac5f, L:/127.0.0.1:7687 - R:/127.0.0.1:63220]
java.net.SocketException: Connection reset
	at sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394) ~[?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426) ~[?:?]
	at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:255) ~[netty-buffer-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) ~[netty-buffer-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:356) ~[netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) [netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [netty-common-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.115.Final.jar:4.1.115.Final]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2025-10-24 11:32:42.729+0000 INFO  [o.n.k.i.t.l.c.CheckPointerImpl] [neo4j/702eda11] Checkpoint triggered by "Scheduled checkpoint for every 15 minutes threshold" @ txId: 32523, append index: 32523 checkpoint started...
2025-10-24 11:32:42.845+0000 INFO  [o.n.k.i.t.l.c.CheckPointerImpl] [neo4j/702eda11] Checkpoint triggered by "Scheduled checkpoint for every 15 minutes threshold" @ txId: 32523, append index: 32523 checkpoint completed in 115ms. Checkpoint flushed 114 pages (0% of total available pages), in 88 IOs. Checkpoint performed with IO limit: 600, paused in total 1 times( 42 millis).
2025-10-24 11:32:42.869+0000 INFO  [o.n.k.i.t.l.p.LogPruningImpl] [neo4j/702eda11] No log version pruned. The strategy used was '2 days'. 

These are the logs from the neo4j.logs file at the time of error.

2025-10-24 11:15:43.017+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 98 of 100 :: Finished
2025-10-24 11:15:43.017+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 98 of 100 :: Start
2025-10-24 11:15:43.044+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 98 of 100 100%
2025-10-24 11:15:43.044+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 98 of 100 :: Finished
2025-10-24 11:15:43.044+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 99 of 100 :: Start
2025-10-24 11:15:43.044+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 99 of 100 100%
2025-10-24 11:15:43.045+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 99 of 100 :: Finished
2025-10-24 11:15:43.045+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 99 of 100 :: Start
2025-10-24 11:15:43.045+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 99 of 100 100%
2025-10-24 11:15:43.045+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 99 of 100 :: Finished
2025-10-24 11:15:43.045+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 99 of 100 :: Start
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 99 of 100 100%
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 99 of 100 :: Finished
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 100 of 100 :: Start
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 100 of 100 100%
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Split old and new neighbors 100 of 100 :: Finished
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 100 of 100 :: Start
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 100 of 100 100%
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Reverse old and new neighbors 100 of 100 :: Finished
2025-10-24 11:15:43.071+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 100 of 100 :: Start
2025-10-24 11:15:43.098+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 100 of 100 100%
2025-10-24 11:15:43.098+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Join neighbors 100 of 100 :: Finished
2025-10-24 11:15:43.098+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Iteration :: Finished
2025-10-24 11:15:43.098+0000 INFO  [neo4j.BoltWorker-4 [bolt-17 - /127.0.0.1:63220]] K-Nearest Neighbours :: Finished