From: Stefan Reiter <s.reiter@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server 1/2] use KillMode 'process' for systemd scope
Date: Tue, 22 Jun 2021 09:23:28 +0200 [thread overview]
Message-ID: <ac161b49-dfc2-28ce-efae-cf5ca2f08f9e@proxmox.com> (raw)
In-Reply-To: <5ea58873-63b0-d14f-0649-574547b57070@proxmox.com>
On 22/06/2021 08:02, Thomas Lamprecht wrote:
> On 21.06.21 18:35, Stefan Reiter wrote:
>> KillMode 'none' is deprecated, and systemd loudly complains about that
>> in the journal. To avoid the warning, but keep the behaviour the same,
>> use KillMode 'process'.
>>
>> This mode does two things differently, which we have to stop it from
>> doing:
>> * it sends SIGTERM right when the scope is cancelled (e.g. on shutdown)
>> -> but only to the "root" process, which in our case is the worker
>> instance forking QEMU, so it is already dead by the time this happens
>> * it sends SIGKILL to *all* children after a timeout
>> -> can be avoided by setting either SendSIGKILL to false, or
>> TimeoutStopUSec to infinity - for safety, we do both
>>
>> In my testing, this replicated the previous behaviour exactly, but
>> without using the deprecated 'none' mode.
>>
>> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
>> ---
>>
>> Depends on updated pve-common from patch 2.
>>
>> PVE/QemuServer.pm | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>> index 07dd14a..d5b7ead 100644
>> --- a/PVE/QemuServer.pm
>> +++ b/PVE/QemuServer.pm
>> @@ -5286,7 +5286,9 @@ sub vm_start_nolock {
>>
>> my %properties = (
>> Slice => 'qemu.slice',
>> - KillMode => 'none'
>> + KillMode => 'process',
>> + SendSIGKILL => 0,
>> + TimeoutStopUSec => ULONG_MAX, # infinity
>
>
> I wasn't sure if ULONG_MAX is used literally, making 71 minutes on 32 bit and ~584k years
> on 64bit, or if it is translated internally to 'infinity', I mean with us only supporting
> 64-bit a duration of 584k year, while not infinity, would be more than enough, but still,
> always good to check those things IMO:
>
> From `src/basic/time-util.h`
>
> typedef uint64_t usec_t;
> ...
> #define USEC_INFINITY ((usec_t) -1)
>
> So, yes, literally means infinity.
>
yeah sorry, should have made the comment more obvious - that's where I
got the value from too
next prev parent reply other threads:[~2021-06-22 7:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 16:35 [pve-devel] [PATCH 0/2] Work around systemd warning about KillMode 'none' Stefan Reiter
2021-06-21 16:35 ` [pve-devel] [PATCH qemu-server 1/2] use KillMode 'process' for systemd scope Stefan Reiter
2021-06-22 6:02 ` Thomas Lamprecht
2021-06-22 7:23 ` Stefan Reiter [this message]
2021-06-23 10:06 ` [pve-devel] applied: " Thomas Lamprecht
2021-06-21 16:35 ` [pve-devel] [PATCH common 2/2] systemd: allow SendSIGKILL and TimeoutStopUSec dbus properties Stefan Reiter
2021-06-22 5:45 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac161b49-dfc2-28ce-efae-cf5ca2f08f9e@proxmox.com \
--to=s.reiter@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=t.lamprecht@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox