[systemd-devel] [PATCH] core: get rid the start job when transitioning to deactivating

Lennart Poettering lennart at poettering.net
Thu Sep 12 09:51:49 PDT 2013


On Fri, 19.07.13 09:17, Lukáš Nykrýn (lnykryn at redhat.com) wrote:

> Hi,
> when service has StopWhenUnneeded=yes and it is requested by forking
> service, which fails during initialization, the first unit is not
> stopped.

I have added this to the TODO list for now, so that we don't
forget. I'll look into it after the next release.

(Sorry for the delay)

> 
> Reproducer:
> 
> -bash-4.2# more /etc/systemd/system/test*
> ::::::::::::::
> /etc/systemd/system/test.service
> ::::::::::::::
> [Unit]
> Description=aaa
> Requires=testb.service
> 
> [Service]
> Type=forking
> ExecStart=/bin/sleep 50
> TimeoutStartSec=3
> 
> ::::::::::::::
> /etc/systemd/system/testb.service
> ::::::::::::::
> [Unit]
> Description=aaa
> StopWhenUnneeded=yes
> 
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=/bin/echo hej
> ExecStop=/bin/echo hou
> 
> -bash-4.2# systemctl status testb test
> testb.service - aaa
>    Loaded: loaded (/etc/systemd/system/testb.service; static)
>    Active: inactive (dead)
> 
> 
> test.service - aaa
>    Loaded: loaded (/etc/systemd/system/test.service; static)
>    Active: inactive (dead)
> 
> -bash-4.2# systemctl start test
> Job for test.service failed. See 'systemctl status test.service' and
> 'journalctl -xn' for details.
> 
> -bash-4.2# systemctl status testb test
> testb.service - aaa
>    Loaded: loaded (/etc/systemd/system/testb.service; static)
>    Active: active (exited) since Thu 2013-07-18 15:34:34 CEST; 7s ago
>   Process: 45 ExecStart=/bin/echo hej (code=exited, status=0/SUCCESS)
> 
> Jul 18 15:34:34 mycontainer systemd[1]: Starting aaa...
> Jul 18 15:34:34 mycontainer systemd[1]: Started aaa.
> 
> test.service - aaa
>    Loaded: loaded (/etc/systemd/system/test.service; static)
>    Active: failed (Result: timeout) since Thu 2013-07-18 15:34:37
> CEST; 4s ago
>   Process: 46 ExecStart=/bin/sleep 50 (code=killed, signal=TERM)
> 
> Jul 18 15:34:34 mycontainer systemd[1]: Starting aaa...
> Jul 18 15:34:37 mycontainer systemd[1]: test.service operation timed
> out. Terminating.
> Jul 18 15:34:37 mycontainer systemd[1]: Failed to start aaa.
> Jul 18 15:34:37 mycontainer systemd[1]: Unit test.service entered
> failed state.


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list