I dug into Windows support for signals and soft/hard kills based on
leads Rob Dolin posted for the Docker code. Here's the message I'd
sent back with my findings:
----- Forwarded message from "W. Trevor King" <
wk...@tremily.us> -----
Date: Wed, 13 Apr 2016 16:58:47 -0700
Subject: Re: Windows support for OCI stop/signal/kill (runtime-spec#356)
Message-ID: <
20160413235...@odin.tremily.us>
On Wed, Apr 13, 2016 at 11:27:02PM +0000, Rob Dolin wrote:
> As I understand, uses can interact with Windows Containers via
> PowerShell or Docker. Windows Containers support both:
>
> * docker stop (graceful stop)
> * docker stop -f (forced immediate stop)
So they're both possible, but I'm not sure how they're implemented.
Looking at signals POSIX attributes to ISO C [1]
SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, and SIGTERM
SIGTERM is probably the only one that needs to be exposed via the
runtime/spec. Although it looks like Windows has a CTRL_C_EVENT which
is probably interchangable with SIGINT [2].
The current help for ‘docker stop’ is talking about SIGTERM and
SIGKILL [3]. Grepping around in docker/docker turned up [4] which
says it's faking signal handling on Windows. There's more discussion
in [5], where it looks like those signals are being handled by [6]
(although that's just from a quick skim through unfamiliar code, and
may not be true ;).
I think it means we need an explicit ‘stop [-f]’ in the runtime-spec
operations for portable stops. We can have the spec talk at a higher
level about “forced stop” and “graceful stop”, but that doesn't help
bundle authors know how to catch and handle graceful stop requests
(they don't get a choice for forced stops ;). If we say that the
graceful stop is SIGTERM on POSIX systems, and whatever is behind
hcsshim.ShutdownComputeSystem [7] on Windows, that should be fine.
Unfortunately, POSIX signals contain a lot of other useful stuff to
[1]. I don't see a portable way to expose all of that. POSIX-based
runtimes are free to standardize on a signal command if they want (or
it could be an optional or required-on-POSIX command in
runtime-spec?).
Cheers,
Trevor
[1]:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
[2]:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686016%28v=vs.85%29.aspx
[3]:
https://github.com/docker/docker/blob/v1.11.0/api/client/stop.go#L19
[4]:
https://github.com/docker/docker/blob/v1.11.0/pkg/signal/signal_windows.go#L19-L24
[5]:
https://github.com/docker/docker/pull/16997
Subject: Windows: [TP4] docker kill handling part two
[6]:
https://github.com/microsoft/hcsshim
[7]:
https://github.com/docker/docker/pull/16997/files#diff-5d0b72cccc4809455d52aadc62329817R230
----- End forwarded message -----
--
This email may be signed or encrypted with GnuPG (
http://www.gnupg.org).
For more information, see
http://en.wikipedia.org/wiki/Pretty_Good_Privacy