Description
Because shim logger processes are created with exec.CommandContext, they never receive the SIGTERM signal when they are killed by the shim process.
This means that the shim logging plugin never gets the chance to clean up before it exits (send buffered logs to destination etc). Having some sort of a mechanism similar to what's listed below would be helpful in a graceful exit of the logging plugin:
SIGTERM is sent to the logger
- A wait for the expiration of a grace period happens
- The shim logging plugin gets
SIGKILL
Steps to reproduce the issue:
Not recording any steps here as it's pretty obvious from the code that there's no grace period being provided to logging plugins to do their cleanup. But, if deemed necessary, a sample plugin binary code can be provided.
Describe the results you received:
The shim logging plugin never receives the SIGTERM signal.
Describe the results you expected:
For SIGTERM to be delivered to the logging plugin.
Output of containerd --version:
$ containerd --version
containerd github.com/containerd/containerd v1.3.0 36cf5b690dcc00ff0f34ff7799209050c3d0c59a
Any other relevant information: N/A
Description
Because shim logger processes are created with
exec.CommandContext, they never receive theSIGTERMsignal when they are killed by the shim process.This means that the shim logging plugin never gets the chance to clean up before it exits (send buffered logs to destination etc). Having some sort of a mechanism similar to what's listed below would be helpful in a graceful exit of the logging plugin:
SIGTERMis sent to the loggerSIGKILLSteps to reproduce the issue:
Not recording any steps here as it's pretty obvious from the code that there's no grace period being provided to logging plugins to do their cleanup. But, if deemed necessary, a sample plugin binary code can be provided.
Describe the results you received:
The shim logging plugin never receives the
SIGTERMsignal.Describe the results you expected:
For
SIGTERMto be delivered to the logging plugin.Output of
containerd --version:Any other relevant information: N/A