2011/7/25 Honza Horak <[email protected]>: > Hi, > > I'm wondering how good systemd is in killing all sub-processes when a > service fails/ends (un)expectedly. Let's say a service forks several times > during its execution and the forked processes do some nasty work to detach > from parent process. Can we be sure that all processes will be > interrupted/killed after main service process ends/fails? > > Thanks for any reply > > Cheers, > > Honza Basically yes. It's one of the features of systemd that no other init system provides:)
Systemd uses cgroups to track childprocesses. A process can call fork() as much as it wants, all the childprocesses will still be in the same cgroup as their parent. On service stop systemdthen sends TERM and later KILL signals to all the processes left in that service's cgroup. The only way to escape would be by the process removing itself from the cgroup, which seems malicious to me and should never be done by any sane service. Mirco _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
