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.

My database is somehow locked by another process / address already in use

Hello,

I have had a database that has been running alright for about 2 months. One day, I see an error pop up about ports and to let Neo4j fix the configurations for me, which I did. When I tried to start my database in the same way I always have, I get this (which is my log):

Starting Neo4j.
2020-06-05 22:11:00.219+0000 WARN Use of deprecated setting port propagation. port 11009 is migrated from dbms.connector.bolt.listen_address to dbms.connector.bolt.advertised_address.
2020-06-05 22:11:00.224+0000 WARN Use of deprecated setting port propagation. port 11010 is migrated from dbms.connector.http.listen_address to dbms.connector.http.advertised_address.
2020-06-05 22:11:00.490+0000 INFO ======== Neo4j 4.0.0 ========
2020-06-05 22:11:00.506+0000 INFO Starting...
2020-06-05 22:11:28.903+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabaseService@10b687f2' was successfully initialized, but failed to start. Please see the attached cause exception "Address already in use". Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabaseService@10b687f2' was successfully initialized, but failed to start. Please see the attached cause exception "Address already in use".
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabaseService@10b687f2' was successfully initialized, but failed to start. Please see the attached cause exception "Address already in use".
at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(ServerStartupErrors.java:45)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:163)
at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:114)
at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:89)
at com.neo4j.server.enterprise.EnterpriseEntryPoint.main(EnterpriseEntryPoint.java:25)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabaseService@10b687f2' was successfully initialized, but failed to start. Please see the attached cause exception "Address already in use".
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:465)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:156)
... 3 more
Caused by: java.lang.RuntimeException: Error starting database server at /Users/tylerchristian/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-49f31745-c904-4969-8ac0-7a7705526a48/installation-4.0.0/data/databases
at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:167)
at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:145)
at com.neo4j.server.database.EnterpriseGraphFactory.newDatabaseManagementService(EnterpriseGraphFactory.java:38)
at org.neo4j.server.database.LifecycleManagingDatabaseService.start(LifecycleManagingDatabaseService.java:88)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444)
... 5 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'Server[backup-server]' was successfully initialized, but failed to start. Please see the attached cause exception "Address already in use".
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:465)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:158)
... 9 more
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:455)
at java.base/sun.nio.ch.Net.bind(Net.java:447)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:551)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1346)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:503)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:488)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:985)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:247)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:344)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:510)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:518)
at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
2020-06-05 22:11:28.905+0000 INFO Neo4j Server shutdown initiated by request

I do not understand why I have gotten this message, especially since things were fine until a few days ago. Because of this, my code is unable to run since it cannot connect to the database (either because it will not start up because of the address issue or there is somehow another process). I know it could be because somehow another process is being ran, but i havent been able to cancel it. What can I do to resolve this? And, if there are any commands that I need to run, where do I type them?

I am using a Mac.

I hope this is something simple or small. Thank you for taking the time to read my post. I greatly appreciate it.

4 REPLIES 4

If you open the terminal, you should be able to kill the process:

ps aux | grep neo4j

You should see a list of processes, and you can then take the process id and kill it. So for me, for example:

$ ps aux | grep neo4j
markhne+  3424  0.0  0.0  21540  1008 pts/1    S+   17:32   0:00 grep --color=auto neo4j
markhne+ 24342 10.0  3.4 7207740 1138656 ?     Sl   16:59   3:22 /home/markhneedham/.config/Neo4j Desktop Canary/Application/distributions/java/zulu11.35.13-ca-jdk11.0.5/bin/java -cp /home/markhneedham/.config/Neo4j Desktop Canary/Application/neo4jDatabases/database-1f1de884-c9c1-4973-b69d-c874baf501cd/installation-4.1.0/plugins:/home/markhneedham/.config/Neo4j Desktop Canary/Application/neo4jDatabases/database-1f1de884-c9c1-4973-b69d-c874baf501cd/installation-4.1.0/conf:/home/markhneedham/.config/Neo4j Desktop Canary/Application/neo4jDatabases/database-1f1de884-c9c1-4973-b69d-c874baf501cd/installation-4.1.0/lib/*:/home/markhneedham/.config/Neo4j Desktop Canary/Application/neo4jDatabases/database-1f1de884-c9c1-4973-b69d-c874baf501cd/installation-4.1.0/plugins/* -Xms512m -Xmx1G -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -XX:MaxInlineLevel=15 -Djdk.nio.maxCachedBufferSize=262144 -Dio.netty.tryReflectionSetAccessible=true -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -Dfile.encoding=UTF-8 com.neo4j.server.enterprise.EnterpriseEntryPoint --home-dir=/home/markhneedham/.config/Neo4j Desktop Canary/Application/neo4jDatabases/database-1f1de884-c9c1-4973-b69d-c874baf501cd/installation-4.1.0 --config-dir=/home/markhneedham/.config/Neo4j Desktop Canary/Application/neo4jDatabases/database-1f1de884-c9c1-4973-b69d-c874baf501cd/installation-4.1.0/conf

I would then need to kill process id 24342:

kill -9 24342

I have tried that as well, and I get this output:

tylerchristian    9910   0.8  7.8  7236248 326216   ??  S     4:12PM   8:54.56 /Users/tylerchristian/Library/Application Support/Neo4j Desktop/Application/distributions/java/zulu11.35.13-ca-jdk11.0.5/bin/java -cp /Users/tylerchristian/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-49f31745-c904-4969-8ac0-7a7705526a48/installation-4.0.0/plugins:/Users/tylerchristian/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-49f31745-c904-4969-8ac0-7a7705526a48/installation-4.0.0/conf:/Users/tylerchristian/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-49f31745-c904-4969-8ac0-7a7705526a48/installation-4.0.0/lib/*:/Users/tylerchristian/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-49f31745-c904-4969-8ac0-7a7705526a48/installation-4.0.0/plugins/* -server -Xms512m -Xmx1G -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=262144 -Dio.netty.tryReflectionSetAccessible=true -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true -Dfile.encoding=UTF-8 com.neo4j.server.enterprise.EnterpriseEntryPoint --home-dir=/Users/tylerchristian/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-49f31745-c904-4969-8ac0-7a7705526a48/installation-4.0.0 --config-dir=/Users/tylerchristian/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-49f31745-c904-4969-8ac0-7a7705526a48/installation-4.0.0/conf
tylerchristian   16590   0.0  0.0  4267752    812 s000  S+    2:41PM   0:00.00 grep neo4j
Tylers-MacBook-Pro-5:~ tylerchristian$ kill -9 16590
-bash: kill: (16590) - No such process

Is there another command that circumvents this? I wonder if this sort of thing can happen due to a crash.

Thank you for your reply.

You want to kill the other one (9910). 16590 is the grep command.

Or did you already try to kill both?

I killed the wrong one. All is well now.

Thank you for reaching out to and helping me!