diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-05-12 11:11:37 +0200 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-06-14 13:18:52 -0400 |
commit | 54d1121c0e5eccd550196d45d456df14bcde8759 (patch) | |
tree | 446d663a3fe4244ccbe477f73e975c39d07288c0 /libpod/oci_conmon_linux.go | |
parent | c004978ea895e5b9a4f67388caba11fa893f586c (diff) | |
download | podman-54d1121c0e5eccd550196d45d456df14bcde8759.tar.gz podman-54d1121c0e5eccd550196d45d456df14bcde8759.tar.bz2 podman-54d1121c0e5eccd550196d45d456df14bcde8759.zip |
sdnotify: send MAINPID only once
Send the main PID only once. Previously, `(*Container).start()` and
the conmon handler sent them ~simultaneously and went into a race.
I noticed the issue while debugging a WIP PR.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r-- | libpod/oci_conmon_linux.go | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index c232702e9..6aa7ce6dc 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -36,7 +36,6 @@ import ( "github.com/containers/podman/v4/utils" "github.com/containers/storage/pkg/homedir" pmount "github.com/containers/storage/pkg/mount" - "github.com/coreos/go-systemd/v22/daemon" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" @@ -1279,19 +1278,6 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co // conmon not having a pid file is a valid state, so don't set it if we don't have it logrus.Infof("Got Conmon PID as %d", conmonPID) ctr.state.ConmonPID = conmonPID - - // Send the MAINPID via sdnotify if needed. - switch ctr.config.SdNotifyMode { - case define.SdNotifyModeContainer, define.SdNotifyModeIgnore: - // Nothing to do or conmon takes care of it already. - - default: - if sent, err := daemon.SdNotify(false, fmt.Sprintf("MAINPID=%d", conmonPID)); err != nil { - logrus.Errorf("Notifying systemd of Conmon PID: %v", err) - } else if sent { - logrus.Debugf("Notify MAINPID sent successfully") - } - } } runtimeRestoreDuration := func() int64 { |