[systemd-devel] Regarding service rate limiting (systemd 237)
Ani A
aniruddha.a at gmail.com
Mon Jul 11 12:56:44 UTC 2022
Hello,
I am on Ubuntu 18.04 (systemd version 237), I have been trying to get
service rate limiting to work, but not getting it right!
I checked/tested many examples with the same directives that I use in
my service files, they all work well (for e.g.)
cat <<EOF > /usr/local/bin/myservice.sh
#!/usr/bin/env bash
sleep $(( $RANDOM % 15 ))
exit 0
EOF
cat <<EOF > /etc/systemd/system/my.service
[Unit]
StartLimitBurst=5
StartLimitIntervalSec=90
[Service]
ExecStart=/bin/bash /usr/local/bin/myservice.sh
RestartSec=5
Restart=always
EOF
but somehow only with the services that I am trying to rate-limit
(C,unix daemons), it doesn't work! :(
I enabled systemd Loglevel=debug but still not getting any clues, the only
odd message I see is:
systemd[1]: my-cdaemon.service: Unknown serialization key: ref-gid
systemd[1]: my-cdaemon.service: Changed dead -> running
systemd[1]: my-cdaemon.service: Unknown serialization key: ref-gid
Is this something to worry about ?
Another difference from conventional service start is, the actual
service is invoked like:
/bin/bash -c 'exec /opt/org/bin/my-cdaemon $OPTS >>
/var/log/org/my-cdaemon.log 2>&1'
This should be OK?
I just want to make sure that the disk is not filled with core files
(the daemon dumps pretty huge core files), hence [trying] to
limit it to 5 restarts, but it keeps restarting forever :(
systemd[1]: my-cdaemon.service: Trying to enqueue job
my-cdaemon.service/restart/replace
systemd[1]: my-cdaemon.service: Installed new job
my-cdaemon.service/restart as 107718
systemd[1]: my-cdaemon.service: Enqueued job
my-cdaemon.service/restart as 107718
systemd[1]: my-cdaemon.service: Scheduled restart job, restart counter
is at 113. <<<<<
systemd[1]: my-cdaemon.service: Changed auto-restart -> dead
systemd[1]: my-cdaemon.service: Job my-cdaemon.service/restart
finished, result=done
I tried to factor the _time taken to write the core file_ as well, in
`StartLimitIntervalSec', still no luck!
How can I troubleshoot this further ? Is there any way to "know" the
internal state that systemd is tracking for this daemon _after 5 restarts_ ?
--
Ani
More information about the systemd-devel
mailing list