Re: [systemd-devel] systemctl how to stop a service

2016-05-16 Thread Christian Boltz
Hello,

Am Samstag, 14. Mai 2016, 16:55:11 CEST schrieb liuxueping:
> I have a test in arm64,my test case try to start/stop a ntp service
> frequently,like that:
> 
>   #!/bin/bash
>   i=0
>   while [ 1 ];do
>   echo "$((i++))"
>   systemctl restart ntpd &
>   kill -9 $!

You are sending systemctl restart ntpd into the background and kill it 
the hard way. I understand you don't want to wait forever, but killing 
it instantly (while it restarts ntpd) could cause some "funny" 
behaviour. This behaviour might also be somewhat random/racy because the 
kill can happen at different states of the restart.

Can you still reproduce the issue you described if you at least add a 
"sleep 5" before killing systemctl?


Regards,

Christian Boltz
-- 
[Greylisting ist] das alte Hotline-Prinzip: Wenn der 4 Minuten lang in
der 01805 dringehangen hat, dann will er auch was von uns. Aber sofort
ans Telefon gehen? Ne!  [Peer Heinlein auf dem LinuxTag Chemnitz 2011]

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemctl how to stop a service

2016-05-16 Thread Andrei Borzenkov
16.05.2016 13:28, Reindl Harald пишет:
> 
> 
> Am 16.05.2016 um 08:58 schrieb Andrei Borzenkov:
>> 16.05.2016 09:01, liuxueping пишет:
>>> Do you mean to say that systemctl will return a value when the process
>>> is still at terminate gracefully?
>>>
>>
>> By default systemctl should wait for stop job to complete. What may
>> happen - if it takes more time than JobTimeout, job is canceled while
>> systemd is still trying to terminate unit. At least so is my
>> understanding
> 
> IT DON'T RELIEABLE - my harddisks still making a lot of nosie by
> suspending 3 VMware guests on a RAOD10 with 4 different disks and i have
> observed similar behavior for single services too
> 
> [root@srv-rhsoft:~]$ time systemctl stop vmware-guest.target
> real0m2.484s
> user0m0.007s
> sys 0m0.010s
> 
> [root@srv-rhsoft:~]$ systemctl status vmware-guest.target
> vmware-guest.target - VMware Guest Group
>Loaded: loaded (/etc/systemd/system/vmware-guest.target; enabled;
> vendor preset: disabled)
>Active: inactive (dead) since Mo 2016-05-16 12:25:18 CEST; 1min 19s ago
> 
> Mai 16 12:25:18 srv-rhsoft.rhsoft.net systemd[1]: Stopped target VMware
> Guest Group.
> Mai 16 12:25:18 srv-rhsoft.rhsoft.net systemd[1]: Stopping VMware Guest
> Group.
> Warning: Journal has been rotated since unit was started. Log output is
> incomplete or unavailable.
> 

I am not sure what this example illustrates. Targets do not start or
stop anything; so stopping *target* does indeed happen instantaneously.
Unless stopping target causes services to be stopped *and* target is
configured to be stopped *after* services.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemctl how to stop a service

2016-05-16 Thread Reindl Harald



Am 16.05.2016 um 08:58 schrieb Andrei Borzenkov:

16.05.2016 09:01, liuxueping пишет:

Do you mean to say that systemctl will return a value when the process
is still at terminate gracefully?



By default systemctl should wait for stop job to complete. What may
happen - if it takes more time than JobTimeout, job is canceled while
systemd is still trying to terminate unit. At least so is my understanding


IT DON'T RELIEABLE - my harddisks still making a lot of nosie by 
suspending 3 VMware guests on a RAOD10 with 4 different disks and i have 
observed similar behavior for single services too


[root@srv-rhsoft:~]$ time systemctl stop vmware-guest.target
real0m2.484s
user0m0.007s
sys 0m0.010s

[root@srv-rhsoft:~]$ systemctl status vmware-guest.target
vmware-guest.target - VMware Guest Group
   Loaded: loaded (/etc/systemd/system/vmware-guest.target; enabled; 
vendor preset: disabled)

   Active: inactive (dead) since Mo 2016-05-16 12:25:18 CEST; 1min 19s ago

Mai 16 12:25:18 srv-rhsoft.rhsoft.net systemd[1]: Stopped target VMware 
Guest Group.
Mai 16 12:25:18 srv-rhsoft.rhsoft.net systemd[1]: Stopping VMware Guest 
Group.
Warning: Journal has been rotated since unit was started. Log output is 
incomplete or unavailable.




在 2016/5/14 18:32, Reindl Harald 写道:


Am 14.05.2016 um 10:55 schrieb liuxueping:

The result of "ps aux" before sleep 5 shows:
root  6698  0.0  0.0  0 0 ?Ds   08:45   0:00 [ntpd]


I'm not sure how to interpret it. For one, it has [...] in name which
indicates it is kernel thread. I am not aware that ntpd starts any
kernel threads and if it does, systemd does not monitor them in any
case. So /if/ this is kernel thread, the result is expected.


After 5 seconds,there is no ntpd process in system.

the stop status is 0,the execution of the stop command is successful,the
PID of the ntpd process is 1.

I would like to know if the systemctl command will wait for all the
processes to exit completely before returning the result


no, not relieable, had much fun with maradb-backups

in case of restart it's different but "stop" is mostly a fire and forget
coming back in the terminal whil the daemon is still at terminate
gracefully - IMHO a bug





___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



--

Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / CISO / Software-Development
m: +43 (676) 40 221 40, p: +43 (1) 595 3999 33
icq: 154546673, http://www.thelounge.net/

http://www.thelounge.net/signature.asc.what.htm



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemctl how to stop a service

2016-05-16 Thread liuxueping


If it is as you say,it takes more time than JobTimeout,job is canceled 
while systemd is still trying to terminate unit,then the return value 
should not be 0.


在 2016/5/16 14:58, Andrei Borzenkov 写道:

16.05.2016 09:01, liuxueping пишет:

Do you mean to say that systemctl will return a value when the process
is still at terminate gracefully?



By default systemctl should wait for stop job to complete. What may
happen - if it takes more time than JobTimeout, job is canceled while
systemd is still trying to terminate unit. At least so is my understanding.


在 2016/5/14 18:32, Reindl Harald 写道:


Am 14.05.2016 um 10:55 schrieb liuxueping:

The result of "ps aux" before sleep 5 shows:
root  6698  0.0  0.0  0 0 ?Ds   08:45   0:00 [ntpd]


I'm not sure how to interpret it. For one, it has [...] in name which
indicates it is kernel thread. I am not aware that ntpd starts any
kernel threads and if it does, systemd does not monitor them in any
case. So /if/ this is kernel thread, the result is expected.


After 5 seconds,there is no ntpd process in system.

the stop status is 0,the execution of the stop command is successful,the
PID of the ntpd process is 1.

I would like to know if the systemctl command will wait for all the
processes to exit completely before returning the result


no, not relieable, had much fun with maradb-backups

in case of restart it's different but "stop" is mostly a fire and forget
coming back in the terminal whil the daemon is still at terminate
gracefully - IMHO a bug





___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemctl how to stop a service

2016-05-16 Thread Andrei Borzenkov
16.05.2016 09:01, liuxueping пишет:
> Do you mean to say that systemctl will return a value when the process
> is still at terminate gracefully?
> 

By default systemctl should wait for stop job to complete. What may
happen - if it takes more time than JobTimeout, job is canceled while
systemd is still trying to terminate unit. At least so is my understanding.

> 在 2016/5/14 18:32, Reindl Harald 写道:
>>
>> Am 14.05.2016 um 10:55 schrieb liuxueping:
>>> The result of "ps aux" before sleep 5 shows:
>>> root  6698  0.0  0.0  0 0 ?Ds   08:45   0:00 [ntpd]

I'm not sure how to interpret it. For one, it has [...] in name which
indicates it is kernel thread. I am not aware that ntpd starts any
kernel threads and if it does, systemd does not monitor them in any
case. So /if/ this is kernel thread, the result is expected.

>>> After 5 seconds,there is no ntpd process in system.
>>>
>>> the stop status is 0,the execution of the stop command is successful,the
>>> PID of the ntpd process is 1.
>>>
>>> I would like to know if the systemctl command will wait for all the
>>> processes to exit completely before returning the result
>>
>> no, not relieable, had much fun with maradb-backups
>>
>> in case of restart it's different but "stop" is mostly a fire and forget
>> coming back in the terminal whil the daemon is still at terminate
>> gracefully - IMHO a bug
>>
>>
>>
>>
>>
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>
> 
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemctl how to stop a service

2016-05-16 Thread liuxueping
Do you mean to say that systemctl will return a value when the process 
is still at terminate gracefully?


在 2016/5/14 18:32, Reindl Harald 写道:


Am 14.05.2016 um 10:55 schrieb liuxueping:

The result of "ps aux" before sleep 5 shows:
root  6698  0.0  0.0  0 0 ?Ds   08:45   0:00 [ntpd]
After 5 seconds,there is no ntpd process in system.

the stop status is 0,the execution of the stop command is successful,the
PID of the ntpd process is 1.

I would like to know if the systemctl command will wait for all the
processes to exit completely before returning the result


no, not relieable, had much fun with maradb-backups

in case of restart it's different but "stop" is mostly a fire and forget
coming back in the terminal whil the daemon is still at terminate
gracefully - IMHO a bug





___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemctl how to stop a service

2016-05-14 Thread Reindl Harald


Am 14.05.2016 um 10:55 schrieb liuxueping:

The result of "ps aux" before sleep 5 shows:
root  6698  0.0  0.0  0 0 ?Ds   08:45   0:00 [ntpd]
After 5 seconds,there is no ntpd process in system.

the stop status is 0,the execution of the stop command is successful,the
PID of the ntpd process is 1.

I would like to know if the systemctl command will wait for all the
processes to exit completely before returning the result


no, not relieable, had much fun with maradb-backups

in case of restart it's different but "stop" is mostly a fire and forget 
coming back in the terminal whil the daemon is still at terminate 
gracefully - IMHO a bug






signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel