Bug#766977: elasticsearch not starting

John Paul Adrian Glaubitz glaubitz at physik.fu-berlin.de
Wed Oct 14 09:02:58 UTC 2015


Control: retitle -1 elasticsearch: Please provide a systemd service file

> However the fact remains, systemd is confusingly reporting ES as
> being started when it is not. IMHO, that's an issue.

Not an issue here. Without START_DAEMON=true, systemd correctly reports
the unit as run successfully and detects the daemon to have exited:

root at vs84:~> systemctl status elasticsearch.service
● elasticsearch.service - LSB: Starts elasticsearch
   Loaded: loaded (/etc/init.d/elasticsearch)
   Active: active (exited) since Tue 2015-10-06 10:17:28 CEST; 1 weeks 1
days ago
root at vs84:~>

Enabling elasticsearch with START_DAEMON=true and systemd will also
detect the process itself as running:

root at vs84:~> systemctl status elasticsearch.service
● elasticsearch.service - LSB: Starts elasticsearch
   Loaded: loaded (/etc/init.d/elasticsearch)
   Active: active (running) since Wed 2015-10-14 10:51:31 CEST; 3s ago
  Process: 17109 ExecStop=/etc/init.d/elasticsearch stop (code=exited,
status=0/SUCCESS)
  Process: 17149 ExecStart=/etc/init.d/elasticsearch start (code=exited,
status=0/SUCCESS)
   CGroup: /system.slice/elasticsearch.service
           └─17203 /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Xms256m
-Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSIn...

Oct 14 10:51:31 vs84 elasticsearch[17149]: Starting Elasticsearch Server:.
root at vs84:~>

systemd is behaving absolutely correctly and as expected. Without
any systemd support from the elasticsearch service, systemd has
to resort to using the LSB compatibility layer and has to evaluate
the status codes of the SysV scripts provided by elasticsearch.

If these scripts return with SUCCESS on "start", systemd has to
assume the service was run successfully albeit it detects that
the process associated with it has exited (which is what you
can see above). There are cases where a unit is run and exits
shortly after (so-called "oneshot" unit in systemd), so it's safe
to assume for systemd to assume that the unit was run successfully
as long as the exit code was zero.

In order to properly fix this problem, the elasticsearch maintainers
should add systemd support to their package by providing a service
file. This is a good idea anyway since systemd is the default init
system since Debian Jessie and SystemV scripts is something we would
like to get rid of in Debian.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz at debian.org
`. `'   Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



More information about the pkg-java-maintainers mailing list