Nexus3 Database Locked After Server Died

979 views
Skip to first unread message

Moustafa Aboul Atta

unread,
Oct 28, 2016, 4:28:16 AM10/28/16
to Nexus Users
I run Nexus3 through the official docker container with a mounted nfs drive.
After the server died, I can't start Nexus again I get the following error:

Caused by: com.orientechnologies.common.concur.lock.OLockException: File '/nexus-data/db/config/database.ocf' is locked by another process, maybe the database is in use by another process. Use the remote mode with a OrientDB server to allow multiple access to the same database

I have two questions:
1. How can I unlock the database for now?
2. How to prevent this from happening again, I don't want to have to intervene manually after everytime something happens
Thanks in advance.

Stuart McCulloch

unread,
Oct 28, 2016, 6:02:46 AM10/28/16
to Moustafa Aboul Atta, Nexus Users
Hi Moustafa,

The database takes an OS-level file lock by default - it looks like the NFS server believes the file is still locked even though the process has died.

Can you try the following while logged in as the Nexus user:

1.  mv  /nexus-data/db  /nexus-data/db.tmp
2.  cp  -fR  /nexus-data/db.tmp  /nexus-data/db

This should clear the NFS lock (since it will create new inodes) and allow you to start - once started you can remove/archive /nexus-data/db.tmp

If you don’t want to copy the whole DB directory then you can also do this once for each file mentioned during startup:

1.  mv  /nexus-data/db/config/database.ocf  /nexus-data/db/config/database.ocf.tmp
2.  cp  /nexus-data/db/config/database.ocf.tmp  /nexus-data/db/config/database.ocf

The alternative is to talk to your NFS administrator to get the file locks cleared for that client.

To stop this happening again in the future you can turn off the database file lock by adding this property to your etc/system.properties file:

file.lock=false

Nexus has it’s own higher-level lock to stop multiple Nexus instances from using the same data directory, so this should be safe..

-- 
Cheers, Stuart
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/f89b2fc4-56ae-44db-b98b-589a0c356943%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Moustafa Aboul Atta

unread,
Oct 28, 2016, 6:54:50 AM10/28/16
to Nexus Users, m.abo...@gmail.com
Hi Stuart,

Thank you for the reply and the solution! It can now run again!

With regard to editing system.properties file, I can't find it. I only have healthcheck.properties under etc/
Can I just create the file with only: file.lock=false

Stuart McCulloch

unread,
Oct 28, 2016, 6:57:29 AM10/28/16
to Moustafa Aboul Atta, Nexus Users
Hi Moustafa,

You can find the system.properties file in NEXUS_HOME/etc/system.properties where NEXUS_HOME is where you installed the Nexus distribution.

-- 
Cheers, Stuart

Moustafa Aboul Atta

unread,
Oct 28, 2016, 8:40:54 AM10/28/16
to Nexus Users, m.abo...@gmail.com
Got it! I was looking in nexus_data
I run it in as a docker container so will build on it.

Thank you a lot again Stuart for the help!

Cheers,
Moustafa
Reply all
Reply to author
Forward
0 new messages