Archemar
Archemar

Reputation: 571

Store and its lock file has been locked by another process: /var/lib/neo4j/data/databases/graph.db/store_lock

what I did

neo4j console

(work fine)

ctrl-C

upon restarting I have message above.

I delete /var/lib/neo4j/data/databases/graph.db/store_lock

then I have

Externally locked: /var/lib/neo4j/data/databases/graph.db/neostore

Is there any way of cleaning lock ? (short of reinstalling)

Upvotes: 10

Views: 12682

Answers (3)

I found this question having same error message trying to import CSV using neo4j-admin tool.

In my case the problem was that I first launched neo4j server:

docker run -d --name testneo4j -p7474:7474 -p7687:7687 -v /path/to/neo4j/data:/data -v /path/to/neo4j/logs:/logs -v /path/to/neo4j/import:/var/lib/neo4j/import -v /path/to/neo4j/plugins:/plugins --env NEO4J_AUTH=neo4j/test neo4j:latest

and then tried to launch import (CSV data files see here):

docker exec -it testneo4j neo4j-admin import --nodes=Movies=import/movies.csv --nodes=Actors=import/actors.csv --relationships=ACTED_IN=import/roles.csv

This leads to lock error since server acquires database lock and neo4j-admin is independent tool which needs to acquire database lock too. Kills, lock file removals and sudos didn't work for me.

What helped:

  1. docker run --rm ... neo4j:latest neo4j-admin ... - this performs one-shot import into empty database. No dead container remains, only imported data in external volume. (Note the command fails if db is not empty.) The point is, the Docker entrypoint starts server unless CMD in Dockerfile is overriden.
  2. docker run -d ... neo4j:latest - this runs neo4j server

Upvotes: 3

Hendrik F
Hendrik F

Reputation: 3930

Killing the Java process and deleting the store_lock worked for me:

Found the lingering process,

ps aux | grep "org.neo4j.server"

killed it,

kill -9 <pid-of-neo4js-java-process>

and deleted

sudo rm /var/lib/neo4j/data/databases/graph.db/store_lock

Allegedly, just killing the lingering process may do the trick but I went ahead and deleted the lock anyway.

Upvotes: 13

anarche
anarche

Reputation: 536

You can kill the java process and delete the store_lock file. It doesn't seem to harm the database integrity.

Upvotes: 6

Related Questions