Neo4j (community edition) stops soon after start and refers wrongly to locked files

Soon after I start a neo4j (4.2.3 community edition) session on a linux terminal, it stops automatically. The files within the logs/ directory indicate that there may be files that are locked by other active neo4j sessions even though that is clearly not true (those files do not show up on "lsof").

Interestingly, this issue arises arbitrarily (runs fine at times) and renders my workflow very untrustworthy. This seems to be an issue many have experienced, but I failed to get any proper solution. I'd appreciate it if someone can help me out with this or point me to the right resources.

@tnnandi

Do you have details of an error that indicates files are locked?

This seems to be an issue many have experienced, but ... ....

i.e. are there other posts on community.neo4j.com where users claim this as well?

and Neo4j 4.2.3 ? Is this a new install or been running for some time. FWIW 4.2.3 was released January 2021 Any reason not to use a more current version. Admittedly at this point its not clear a upgrade will fix the 'locked' files since its not completely understood but rather a newer version would have more fixes

Thanks for the response @dana_canzano ! I'm using 4.2.3 because I have a dump file that is not consistent with the later versions of neo4j (and I didn't find any intuitive and reliable way to convert the dump file to make it compatible). There are a few posts on Stack Overflow that mention this issue (but they aren't for linux), but probably not on this discussion forum.

Please find attached a screenshot of the problem (it takes approximately 15-20 seconds after start for the status to show that Neo4j is not running).

@dana_canzano Also, here's a screenshot of the error I get while importing the dump file to a neo4j 4.4.19 database [The loaded database is not on the latest format (current:AF4.1.a, latest:AF4.3.0). Set dbms.allow_upgrade=true to enable migration.].

The screenshot shows the output for the import process on 2 neo4j versions (4.4.19 and 4.2.3) and you can see how the process goes smoothly for 4.2.3. (Also, please note that setting dbms.allow_upgrade=true in the neo4j.conf file doesn't fix the issue)

@tnnandi

  1. what does log/neo4j.log report ?

  2. any plans to address the WARNING: Max 16384 open files allowed. Minimum 40000 recommened? Linux executable (.tar) - Operations Manual

HI @dana_canzano ,

After your response, I could successfully start a neo4j session and kept it on for the past few days and I didn't have a log file for a failed session to share with you. Today, I had to stop that session and restart, and again encountered the same issue. Please find the content of the neo4j.log file below. Also, I think we can ignore the warning for now as the successful session had the warning too.

nohup: ignoring input
2023-05-04 21:48:53.552+0000 WARN  Use of deprecated setting dbms.active_database. It is replaced by dbms.default_database
2023-05-04 21:48:53.576+0000 INFO  Starting...
2023-05-04 21:48:55.941+0000 INFO  ======== Neo4j 4.2.3 ========
2023-05-04 21:49:01.383+0000 ERROR Failed to start Neo4j on dbms.connector.http.listen_address, a socket address. If missing port or hostname it is acquired from dbms.default_listen_address.
java.lang.RuntimeException: Error starting Neo4j database server at /lus/grand/projects/RNAtoImage/KG/neo4j_unix/neo4j-community-4.2.3/data/databases
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:207) ~[neo4j-4.2.3.jar:4.2.3]
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:163) ~[neo4j-4.2.3.jar:4.2.3]
        at org.neo4j.server.CommunityBootstrapper.createNeo(CommunityBootstrapper.java:36) ~[neo4j-4.2.3.jar:4.2.3]
        at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:134) [neo4j-4.2.3.jar:4.2.3]
        at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:90) [neo4j-4.2.3.jar:4.2.3]
        at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:35) [neo4j-4.2.3.jar:4.2.3]
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.internal.locker.LockerLifecycleAdapter@47874b25' was successfully initialized, but failed to start. Please see the attached cause exception "Lock file has been locked by another process: /lus/grand/projects/RNAtoImage/KG/neo4j_unix/neo4j-community-4.2.3/data/databases/store_lock. Please ensure no other process is using this database, and that the directory is writable (required even for read-only access)".
        at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:463) ~[neo4j-common-4.2.3.jar:4.2.3]
        at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:110) ~[neo4j-common-4.2.3.jar:4.2.3]
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:198) ~[neo4j-4.2.3.jar:4.2.3]
        ... 5 more
Caused by: org.neo4j.kernel.internal.locker.FileLockException: Lock file has been locked by another process: /lus/grand/projects/RNAtoImage/KG/neo4j_unix/neo4j-community-4.2.3/data/databases/store_lock. Please ensure no other process is using this database, and that the directory is writable (required even for read-only access)
        at org.neo4j.kernel.internal.locker.Locker.storeLockException(Locker.java:175) ~[neo4j-kernel-4.2.3.jar:4.2.3]
        at org.neo4j.kernel.internal.locker.Locker.checkLock(Locker.java:95) ~[neo4j-kernel-4.2.3.jar:4.2.3]
        at org.neo4j.kernel.internal.locker.GlobalFileLocker.checkLock(GlobalFileLocker.java:58) ~[neo4j-kernel-4.2.3.jar:4.2.3]
        at org.neo4j.kernel.internal.locker.GlobalLocker.checkLock(GlobalLocker.java:28) ~[neo4j-kernel-4.2.3.jar:4.2.3]
        at org.neo4j.kernel.internal.locker.LockerLifecycleAdapter.start(LockerLifecycleAdapter.java:36) ~[neo4j-kernel-4.2.3.jar:4.2.3]
        at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:442) ~[neo4j-common-4.2.3.jar:4.2.3]
        at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:110) ~[neo4j-common-4.2.3.jar:4.2.3]
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:198) ~[neo4j-4.2.3.jar:4.2.3]
        ... 5 more
2023-05-04 21:49:01.385+0000 INFO  Neo4j Server shutdown initiated by request
2023-05-04 21:49:01.385+0000 INFO  Stopped.

given the above it appears a linux process is still attached to

Lock file has been locked by another process: /lus/grand/projects/RNAtoImage/KG/neo4j_unix/neo4j-community-4.2.3/data/databases/store_lock. 

Please ensure no other process is using this database, and that the directory is writable (required even for read-only access)
  1. how is it that you are stopping Neo4j?
  2. any plans to address the WARNING: Max 16384 open files allowed. Minimum 40000 recommened? Linux executable (.tar) - Operations Manual
  3. What OS / version is this?

HI @dana_canzano ,

I'm stopping neo4j using "./bin/neo4j status" from the appropriate directory. I think your suggestion worked: I listed all processes related to neo4j using "ps -ef | grep neo4j" and killed them. Then when I restarted neo4j, it seems to work fine. I'm not sure why the same steps (killing active neo4j processes) was not working earlier.

Thank you very much for the inputs!