In the company I am working now there is a legacy service and its init script is using old SysvInit, but is running over systemd (CentOS 7).
Because there's a lot of computation, this service takes around 70 seconds to finish. I didn't configure any timeout for systemd, and didn't change the default configs at /etc/systemd/system.conf
, but still when I execute service SERVICE stop
my service is timing out after 60 seconds.
Checking with journalctl -b -u SERVICE.service
I find this log:
Sep 02 11:27:46 service.hostname systemd[1]: Stopping LSB: Start/Stop
Sep 02 11:28:46 service.hostname SERVICE[24151]: Stopping service: Error code: 255
Sep 02 11:28:46 service.hostname SERVICE[24151]: [FAILED]
I already tried changing the DefaultTimeoutStopSec
property at /etc/systemd/system.conf
to 90s
, but the timeout still happens.
Does anyone have any idea why is it timeouting at 60s? Is there somewhere else that this timeout value is configured? Is there a way I can check it?
This service runs with java 7 and to daemonize it, it uses JSVC. I configured the -wait
parameter with the value 120
.
TimeoutSec=infinity
— wouldn't it be possible that this block a reboot indefinitely? What if it takes "forever" for that process to exit? I'd suggest a large amount, like5min
, but probably notinfinity
... – Alexis Wilke Dec 13 '16 at 06:09systemd
offersystemctl edit
(andmask
to disable them with brute force, as opposed todisable
) for that very purpose. You should never edit the files in/usr/lib/systemd
. – 0xC0000022L May 15 '18 at 11:43TimeoutSec=infinity
didn't work here, I usedTimeOutSec=900
(15 min) and that saved my posterior. -- I needed to runsystemctl daemon-reload
afterwards, before restarting the service. – JCCyC Nov 01 '18 at 15:05TimeoutSec=900
– Stony Jan 06 '20 at 06:02