Hi,
I’ve been having this issue for a long time and I thought it was due to the automatic script installation but I’ve spent some time recently manually installing seafile and the issue persists.
On seafile start there are 2 elasticsearch java processes created which causes elasticsearch to crash and restart - this will go on indefinitely with the increasing cpu load and RAM making the server unresponsive.
This issue has been referenced multiple times here in the forum:
I am hosting seafile (pro edition) on a Kimsufi server. I have installed it on a KVM VM at home and the issue is not present - so, I thought it was due to something OVH may have done to the kernel which led me to install ubuntu (tried 16.04, 18.04 and 20.04) from debootstrap but the issue remains with all editions.
It has nothing to do with lack of RAM (server has 4GB, there is only 1 user and the issue is present when I first start seafile right after installation, without any data, any libraries or even any seahub user created); I have also checked values at seafile-server-latest/pro/elasticsearch/config/jvm.options (both correctly configured with “Xms1g”, starting seafile with the option “LimitNOFILE=65536” and adding “vm.max_map_count=262144” to the sysctl.conf file - all to no avail. I have also confirmed that all permissions and file/folder ownership are set correctly. I have tried deleting all nodes under pro-data to no avail (again, this happens even before there are any nodes, at the very first start of seafile after running installation script)
The elasticsearch log file shows:
[2021-02-15T20:16:35,485][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/opt/seafile/pro-data/search/data/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.13.jar:5.6.13]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/opt/seafile/pro-data/search/data/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:265) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.13.jar:5.6.13]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.13.jar:5.6.13]
The controller log:
[02/15/21 20:13:08] seafile-controller.c(96): spawn_process: /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/bin/elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
[02/15/21 20:13:08] seafile-controller.c(130): spawned /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/bin/elasticsearch, pid 23916
[02/15/21 20:13:18] seafile-controller.c(585): pid file /opt/seafile/pids/elasticsearch.pid does not exist
[02/15/21 20:13:18] seafile-controller.c(633): elasticsearch need restart...
[02/15/21 20:13:18] seafile-controller.c(96): spawn_process: /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/bin/elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
[02/15/21 20:13:18] seafile-controller.c(130): spawned /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/bin/elasticsearch, pid 23979
[02/15/21 20:13:28] seafile-controller.c(585): pid file /opt/seafile/pids/elasticsearch.pid does not exist
[02/15/21 20:13:28] seafile-controller.c(633): elasticsearch need restart...
[02/15/21 20:13:28] seafile-controller.c(96): spawn_process: /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/bin/elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
[02/15/21 20:13:28] seafile-controller.c(130): spawned /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/bin/elasticsearch, pid 24042
The various java processes being created (note that one process remains locked, which forces elasticsearch to keep restarting and creating a new process):
$ ps aux | grep 'java'
seafile 23443 78.9 30.9 4565156 1243432 ? Sl 20:11 1:21 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24042 140 28.3 3513748 1138964 ? Sl 20:13 0:05 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24094 0.0 0.0 8160 668 pts/0 S+ 20:13 0:00 grep java
$ ps aux | grep 'java'
seafile 23443 71.4 30.9 4565156 1243696 ? Sl 20:11 1:21 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24107 138 28.4 3513748 1139888 ? Sl 20:13 0:06 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24159 0.0 0.0 8160 732 pts/0 S+ 20:13 0:00 grep java
$ ps aux | grep 'java'
seafile 23443 67.2 30.9 4565156 1243696 ? Sl 20:11 1:21 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24172 82.5 26.5 1665352 1064328 ? Sl 20:13 0:01 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24211 0.0 0.0 8160 736 pts/0 S+ 20:13 0:00 grep java
$ ps aux | grep 'java'
seafile 23443 60.8 30.9 4565156 1243696 ? Sl 20:11 1:21 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24237 157 28.4 3513748 1142408 ? Sl 20:13 0:07 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24289 0.0 0.0 8160 736 pts/0 S+ 20:14 0:00 grep java
$ ps aux | grep 'java'
seafile 23443 50.0 30.9 4565156 1243696 ? Sl 20:11 1:21 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24427 143 28.3 3513748 1138680 ? Sl 20:14 0:05 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24479 0.0 0.0 8160 736 pts/0 S+ 20:14 0:00 grep java
$ ps aux | grep 'java'
seafile 23443 40.5 30.9 4565156 1243696 ? Sl 20:11 1:21 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24681 63.0 27.9 3046356 1121668 ? Sl 20:15 0:01 /bin/java -Xms1g -Xmx1g -XX:-AssumeMP -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch -cp /opt/seafile/seafile-pro-server-7.1.13/pro/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.logs=/opt/seafile/logs -Epath.data=/opt/seafile/pro-data/search/data -Enetwork.host=127.0.0.1 -p /opt/seafile/pids/elasticsearch.pid
seafile 24724 0.0 0.0 8160 664 pts/0 S+ 20:15 0:00 grep java
The strangest thing for me is the fact that I am unable to reproduce this issue at home installing seafile on a proxmox VM but no matter what i do the issue is recurring on the kimsufi servers (KS-3). The issue has been present for well over a year, possibly since seafile 6.x
The only way is to either kill the stuck java process or restart seafile (sometimes several times as restarting seafile can cause the same issue again). Starting seafile from systemctl or using seafile user is exactly the same.
This is driving me crazy and I’m all out of ideas. Any help would be very much appreciated.