News for hackers. Stuff that matters.
Re:Systemd auto-restarts of units can hide problems from you by pikahumu on Tuesday August 01, 2023 @04:47AM (#36953830)
The reasonable way to notice is to have alerts for any unexpected restarts. Relying on noticing intermittent service disruption is bound to fail. And so is "remembering to check for this":

> in the future I'm going to want to remember to check for this

Whenever you think that sentence, you should notice this as a red flag and re-think your approach. You will forget. And if not you, then somebody else in your team. You need automation for things you can forget, otherwise your mental checklists will grow too large to handle and are just a distraction.

Re:Systemd auto-restarts of units can hide problems from you by harry8 on Tuesday August 01, 2023 @05:10AM (#36953984)
This is good advice imho.

Away from things that can be automated and are important you have a checklist and tick things off with a pen. Add $this to the list.

Atul Gawande is worth reading in general and on this topic. [1] He turned it into a book I haven't yet read.

[1] https://www.newyorker.com/magazine/2007/12/10/the-checklist

Re:Systemd auto-restarts of units can hide problems from you by thayne on Tuesday August 01, 2023 @05:03AM (#36953947)
What is the best way to set up those alerts? Specifically how do you set something up that knows if unexpected restarts happened? Is there a dbus or similar event you can listen for?
Re:Systemd auto-restarts of units can hide problems from you by pnutjam on Tuesday August 01, 2023 @10:45AM (#36956607)
Re:Systemd auto-restarts of units can hide problems from you by cramjabsyn on Tuesday August 01, 2023 @11:43AM (#36957536)
Worth looking into prometheus. in basic form that'd be gathering metrics from https://github.com/prometheus-community/systemd_exporter on your hosts, and configure alerting in grafana or prometheus alertmanager to notify when a threshold is exceeded
Re:Systemd auto-restarts of units can hide problems from you by bayindirh on Tuesday August 01, 2023 @06:13AM (#36954322)
> The reasonable way to notice is to have alerts for any unexpected restarts.

Yes, and to have alerts, I have resorted to write my own small tools [0][1] at the end of the day. Railgun proved to be very useful, but for smaller things, I'm writing the second one.

[0]: https://git.sr.ht/~bayindirh/railgun

[1]: https://sr.ht/~bayindirh/nudge/

Re:Systemd auto-restarts of units can hide problems from you by JohnMakin on Tuesday August 01, 2023 @11:27AM (#36957256)
In a kubernetes environment, systemd auto-restarting a process inside of a container can hide problems like the article says - if it successfully restarts the process before a liveness probe can pick it up, even if you monitor something like container restarts, you could easily miss this.
Re:Systemd auto-restarts of units can hide problems from you by joombaga on Tuesday August 01, 2023 @12:36PM (#36958392)
Are you talking about running systemd inside a container? Feels like an unnecessary layer.
Re:Systemd auto-restarts of units can hide problems from you by cramjabsyn on Tuesday August 01, 2023 @11:40AM (#36957486)
> The reasonable way to notice is to have alerts for any unexpected restarts. Relying on noticing intermittent service disruption is bound to fail.

I'd argue that unexpected restarts should alert beyond a threshold. Alerting on every occurrence is too noisy. If an individual unit failure causes a service disruption architecture improvements are needed.

Re:Systemd auto-restarts of units can hide problems from you by pikahumu on Wednesday August 09, 2023 @08:50AM (#37061869)
Don't you want to know if something restarts unexpectedly? It's a bug that should be understood and fixed. (If it's not a bug then it's not unexpected.)
Re:Systemd auto-restarts of units can hide problems from you by SoftTalker on Tuesday August 01, 2023 @01:24PM (#36959213)
But if you have too many alerts, you have to remember to check those, and the temptation is to skim over them, and then you'll inevitably miss stuff. Then you need an alert system to alert you to the really important alerts.