[systemd-devel] Processes running after a service has stopped

Ross Lagerwall rosslagerwall at gmail.com
Fri Nov 28 05:42:22 PST 2014


The handling of a service with KillMode set to something other than cgroup
is a bit confusing (as of systemd 208).

Suppose I have a service which has KillMode set to process and it happens
to leave some children behind.
# systemctl start tester
# systemctl status tester
tester.service - tester service
   Loaded: loaded (/etc/systemd/system/tester.service; static)
   Active: active (running) since Fri 2014-11-28 13:32:40 GMT; 2s ago
 Main PID: 5690 (tester)
   CGroup: /system.slice/tester.service
           ├─5690 /home/ross/tester start
           └─5691 /home/ross/tester start

# systemctl stop tester
# systemctl status tester
tester.service - tester service
   Loaded: loaded (/etc/systemd/system/tester.service; static)
   Active: inactive (dead)

Now even though there is still a process running, systemd doesn't indicate
this.  Furthermore, trying to kill these processes doesn't work because the
service is "stopped":
# systemctl kill --kill-who=all tester.service
Failed to issue method call: Unit tester.service is not loaded.

Even more confusing, when the service is started again, the existing process
reappears:
# systemctl start tester
# systemctl status tester
tester.service - tester service
   Loaded: loaded (/etc/systemd/system/tester.service; static)
   Active: active (running) since Fri 2014-11-28 13:36:09 GMT; 7s ago
 Main PID: 5730 (tester)
   CGroup: /system.slice/tester.service
           ├─5691 /home/ross/tester start
           ├─5730 /home/ross/tester start
           └─5731 /home/ross/tester start

Is there a reason for the way this is handled?  Perhaps systemd could show
existing processes for a service regardless of the state the service is in?

Also, perhaps systemd could allow killing these processes even if the service
is "stopped"?

Regards
--
Ross Lagerwall


More information about the systemd-devel mailing list