Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StartLimitIntervalSec=0 or how to Restart Forever #170

Open
tunafishman opened this issue Nov 29, 2023 · 1 comment
Open

StartLimitIntervalSec=0 or how to Restart Forever #170

tunafishman opened this issue Nov 29, 2023 · 1 comment

Comments

@tunafishman
Copy link

I'm currently using a service from a vendor who seems to have ported their setup into k8s by using this python replacement for systemd as the entrypoint to the containers. Their product relies on a service running via systemctl which keeps a connection to a server pod. When that server pod gets restarted the service loses connection and fails.

The service is configured with StartLimitIntervalSec=0 in the [Unit] definition which, according to resources like this one will mean that it gets restarted forever and will eventually, in this case, find a reference to the new server pod. Unfortunately that seems to not work in this python driven universe. The service fails and the product falls down and needs manual intervention via kubectl exec to run systemctl restart and get things back on track. In my case that means anything like automatic patching is guaranteed to break the whole system unless the entire process is babysat.

I did experiment and see that StartLimitIntervalSec=0 in the [Unit] section doesn't seem to override the systemctl.py default of 10, but placing it within the [Service] definition does. And even then the underlying restart loop doesn't seem to give the expected behavior when this value is set to 0.

Tl;Dr: Is there a way to configure a service via systemctl3.py such that it will continue trying to Restart forever?

@gdraheim
Copy link
Owner

gdraheim commented Feb 5, 2024

According to the documentation, there is a special value "infinity" - the usage of =0 is not documented.

https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#StartLimitIntervalSec=interval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants