Merge pull request #11240 from vrothberg/art

make sure that signal buffers are sufficiently big
This commit is contained in:
openshift-ci[bot]
2021-08-17 13:14:22 +00:00
committed by GitHub
3 changed files with 7 additions and 4 deletions

View File

@ -35,7 +35,7 @@ func Start() error {
return nil return nil
} }
sigChan = make(chan os.Signal, 1) sigChan = make(chan os.Signal, 2)
cancelChan = make(chan bool, 1) cancelChan = make(chan bool, 1)
stopped = false stopped = false

View File

@ -12,13 +12,17 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
// Make sure the signal buffer is sufficiently big.
// runc is using the same value.
const signalBufferSize = 2048
// ProxySignals ... // ProxySignals ...
func ProxySignals(ctr *libpod.Container) { func ProxySignals(ctr *libpod.Container) {
// Stop catching the shutdown signals (SIGINT, SIGTERM) - they're going // Stop catching the shutdown signals (SIGINT, SIGTERM) - they're going
// to the container now. // to the container now.
shutdown.Stop() shutdown.Stop()
sigBuffer := make(chan os.Signal, 128) sigBuffer := make(chan os.Signal, signalBufferSize)
signal.CatchAll(sigBuffer) signal.CatchAll(sigBuffer)
logrus.Debugf("Enabling signal proxying") logrus.Debugf("Enabling signal proxying")

View File

@ -397,8 +397,6 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo
return false, -1, errors.Wrapf(err, "error setting up the process") return false, -1, errors.Wrapf(err, "error setting up the process")
} }
c := make(chan os.Signal, 1)
signals := []os.Signal{} signals := []os.Signal{}
for sig := 0; sig < numSig; sig++ { for sig := 0; sig < numSig; sig++ {
if sig == int(unix.SIGTSTP) { if sig == int(unix.SIGTSTP) {
@ -407,6 +405,7 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo
signals = append(signals, unix.Signal(sig)) signals = append(signals, unix.Signal(sig))
} }
c := make(chan os.Signal, len(signals))
gosignal.Notify(c, signals...) gosignal.Notify(c, signals...)
defer gosignal.Reset() defer gosignal.Reset()
go func() { go func() {