Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Configurable stop signals for containers (read from image config) #306

@jawnsy

Description

@jawnsy

When StopContainer is called, the container will be forcibly terminated with the SIGKILL signal, which cannot be caught or handled by processes. This immediately kills processes without prior warning, which may result in data loss for some types of workloads (such as databases) or other undesirable behaviour (such as connection timeouts, as applications don't have a chance to gracefully close connections).

Code reference: https://github.com/kubernetes-incubator/cri-o/blob/master/oci/oci.go#L278

List of available signals: https://en.wikipedia.org/wiki/Unix_signal#POSIX_signals

We should consider a more graceful shutdown sequence, such as:

  1. Send process SIGTERM
  2. Wait up to 60 seconds for the process to die
  3. Log an warning ("process did not stop after ...") and issue a SIGKILL to forcibly kill the process

I think Docker Engine currently does something like this, so we can use that behaviour as inspiration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions