Submitted: https://issues.apache.org/jira/browse/ZOOKEEPER-2079
Thanks. On 12 November 2014 08:01, Michi Mutsuzaki <[email protected]> wrote: > Hi Guillaume. Sending sigterm instead of sigkill sounds fine to me. > Please go ahead and submit a patch. > > Thanks! > --Michi > > On Tue, Nov 11, 2014 at 11:49 AM, Guillaume Alaux <[email protected]> > wrote: > > Hello, > > > > I noticed script zkServer.sh stops zookeeper by sending the java > > process a `kill -9` (SIGKILL). Is there any technical reason to use > > such a radical signal rather than SIGTERM (-15) for instance? > > > > I am wondering this because I am working on Systemd service files for > > Zookeeper [0] [1] and this `-9` actually makes Systemd consider the > > Zookeeper java process fails when stop is called as shown by the > > following Systemd log: > > > > ---------------8<--------------- > > # sudo systemctl status zookeeper.service > > ● zookeeper.service - Highly reliable distributed coordination server > > Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; disabled) > > Active: failed (Result: signal) since Wed 2014-11-05 11:23:29 CET; 2s > ago > > Process: 656 ExecStop=/usr/bin/zkServer.sh stop (code=exited, > > status=0/SUCCESS) > > Process: 406 ExecStart=/usr/bin/zkServer.sh start (code=exited, > > status=0/SUCCESS) > > Main PID: 414 (code=killed, signal=KILL) > > > > Nov 05 11:23:29 magenta zookeeper[656]: Stopping zookeeper ... STOPPED > > Nov 05 11:23:29 magenta systemd[1]: zookeeper.service: main process > > exited, code=killed, status=9/KILL > > Nov 05 11:23:29 magenta systemd[1]: Unit zookeeper.service entered > failed state. > > ---------------8<--------------- > > > > There is no way to make this `status=9/KILL` to be recognized by > > Systemd as a regular exit code, even with `SuccessExitStatus=9 KILL > > SIGKILL`. On the other hand, turning this `kill -9` into a regular > > `kill` (-15 implied) makes it: > > > > ---------------8<--------------- > > # sudo systemctl status zookeeper.service > > ● zookeeper.service - Highly reliable distributed coordination server > > Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; disabled) > > Active: inactive (dead) > > > > Nov 05 11:14:27 magenta zookeeper[30032]: Using config: > > /usr/share/zookeeper/bin/../conf/zoo.cfg > > Nov 05 11:14:27 magenta zookeeper[30032]: Stopping zookeeper ... STOPPED > > ---------------8<--------------- > > > > I would gladly submit a tiny patch for this (and maybe also submit the > > service file) but would first like to have your opinion on the reasons > > to use SIGKILL. > > > > [0] > https://github.com/galaux/aurpkgs/blob/master/zookeeper/systemd_zookeeper.service > > [1] > https://github.com/galaux/aurpkgs/blob/master/zookeeper/systemd_zookeeper%40.service > > > > -- > > Guillaume >
