[systemd-devel] Processes running after a service has stopped
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 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Processes running after a service has stopped
On Fri, 28.11.14 13:42, Ross Lagerwall (rosslagerw...@gmail.com) wrote: The handling of a service with KillMode set to something other than cgroup is a bit confusing (as of systemd 208). Hmm, could you test this with newer systemd please? 208 is already quite old. Where (in terms of: which cgroup?) does systemd-cgls show the left-over processes? We should show the cgroup contents regardless of the state of a service actually, nothing should be hidden there. If things are hidden just because of the service state then this would be a bug. If you can reproduce it with 217 or so that would be great! Thanks! Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Processes running after a service has stopped
On Fri, Nov 28, 2014 at 07:53:33PM +0100, Lennart Poettering wrote: On Fri, 28.11.14 13:42, Ross Lagerwall (rosslagerw...@gmail.com) wrote: The handling of a service with KillMode set to something other than cgroup is a bit confusing (as of systemd 208). Hmm, could you test this with newer systemd please? 208 is already quite old. Where (in terms of: which cgroup?) does systemd-cgls show the left-over processes? In it's own cgroup, as would normally be the case: │ ├─tester.service │ │ └─24709 /home/ross/Downloads/tester start We should show the cgroup contents regardless of the state of a service actually, nothing should be hidden there. If things are hidden just because of the service state then this would be a bug. If you can reproduce it with 217 or so that would be great! The same behavior seems to occur with 217 (on Arch): # systemctl start tester.service # systemctl status tester.service ● tester.service - Tester service Loaded: loaded (/etc/systemd/system/tester.service; static) Active: active (running) since Fri 2014-11-28 19:46:21 GMT; 4s ago Main PID: 25067 (tester) CGroup: /system.slice/tester.service ├─25067 /home/ross/Downloads/tester start └─25068 /home/ross/Downloads/tester start # systemctl stop tester # systemctl status tester.service ● tester.service - Tester service Loaded: loaded (/etc/systemd/system/tester.service; static) Active: inactive (dead) # ps aux | grep tester root 25068 0.0 0.0 404876 ?S19:46 0:00 /home/ross/Downloads/tester start # systemctl start tester.service # systemctl status tester.service ● tester.service - Tester service Loaded: loaded (/etc/systemd/system/tester.service; static) Active: active (running) since Fri 2014-11-28 19:50:58 GMT; 2s ago Main PID: 25148 (tester) CGroup: /system.slice/tester.service ├─25068 /home/ross/Downloads/tester start -- the left over process! ├─25148 /home/ross/Downloads/tester start └─25149 /home/ross/Downloads/tester start With 217, running systemctl kill --kill-who=all -s KILL tester.service doesn't fail, but it doesn't seem to do anything either. Thanks, -- Ross Lagerwall ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel