mirror of
https://github.com/containers/podman.git
synced 2025-05-21 09:05:56 +08:00
Merge pull request #15566 from mheon/fix_15557
Inhibit SIGTERM during Conmon startup
This commit is contained in:
@ -27,6 +27,7 @@ import (
|
|||||||
cutil "github.com/containers/common/pkg/util"
|
cutil "github.com/containers/common/pkg/util"
|
||||||
"github.com/containers/podman/v4/libpod/define"
|
"github.com/containers/podman/v4/libpod/define"
|
||||||
"github.com/containers/podman/v4/libpod/events"
|
"github.com/containers/podman/v4/libpod/events"
|
||||||
|
"github.com/containers/podman/v4/libpod/shutdown"
|
||||||
"github.com/containers/podman/v4/pkg/ctime"
|
"github.com/containers/podman/v4/pkg/ctime"
|
||||||
"github.com/containers/podman/v4/pkg/lookup"
|
"github.com/containers/podman/v4/pkg/lookup"
|
||||||
"github.com/containers/podman/v4/pkg/rootless"
|
"github.com/containers/podman/v4/pkg/rootless"
|
||||||
@ -1038,6 +1039,13 @@ func (c *Container) init(ctx context.Context, retainRetries bool) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To ensure that we don't lose track of Conmon if hit by a SIGTERM
|
||||||
|
// in the middle of setting up the container, inhibit shutdown signals
|
||||||
|
// until after we save Conmon's PID to the state.
|
||||||
|
// TODO: This can likely be removed once conmon-rs support merges.
|
||||||
|
shutdown.Inhibit()
|
||||||
|
defer shutdown.Uninhibit()
|
||||||
|
|
||||||
// With the spec complete, do an OCI create
|
// With the spec complete, do an OCI create
|
||||||
if _, err = c.ociRuntime.CreateContainer(c, nil); err != nil {
|
if _, err = c.ociRuntime.CreateContainer(c, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1073,6 +1081,7 @@ func (c *Container) init(ctx context.Context, retainRetries bool) error {
|
|||||||
if err := c.save(); err != nil {
|
if err := c.save(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.config.HealthCheckConfig != nil {
|
if c.config.HealthCheckConfig != nil {
|
||||||
if err := c.createTimer(); err != nil {
|
if err := c.createTimer(); err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
|
Reference in New Issue
Block a user