From 7f8ce7d86e8c8741df6f98b7de0842527a512f9f Mon Sep 17 00:00:00 2001 From: Adam Hughes Date: Tue, 21 Apr 2020 22:45:28 +0000 Subject: [PATCH 1/2] Ignore SIGURG in StartProcess (#5231) --- internal/pkg/runtime/engine/singularity/process_linux.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/pkg/runtime/engine/singularity/process_linux.go b/internal/pkg/runtime/engine/singularity/process_linux.go index f51af54ed6..f9c1105436 100644 --- a/internal/pkg/runtime/engine/singularity/process_linux.go +++ b/internal/pkg/runtime/engine/singularity/process_linux.go @@ -56,7 +56,9 @@ const defaultShell = "/bin/sh" func (e *EngineOperations) StartProcess(masterConn net.Conn) error { // Manage all signals. // Queue them until they're ready to be handled below. - signals := make(chan os.Signal, 1) + // Use a channel size of two here, since we may receive SIGURG, which is + // used for non-cooperative goroutine preemption starting with Go 1.14. + signals := make(chan os.Signal, 2) signal.Notify(signals) if err := e.runFuseDrivers(true, -1); err != nil { @@ -244,6 +246,11 @@ func (e *EngineOperations) StartProcess(masterConn net.Conn) error { statusChan <- status } } + case syscall.SIGURG: + // Ignore SIGURG, which is used for non-cooperative goroutine + // preemption starting with Go 1.14. For more information, see + // https://github.com/golang/go/issues/24543. + break default: signal := s.(syscall.Signal) // EPERM and EINVAL are deliberately ignored because they can't be From b485a157041a7057e4a1266df4d182b4c698b96d Mon Sep 17 00:00:00 2001 From: Adam Hughes Date: Wed, 22 Apr 2020 20:41:46 +0000 Subject: [PATCH 2/2] Ignore SIGURG in MonitorContainer (#5231) --- internal/app/starter/master_linux.go | 4 +++- internal/pkg/runtime/engine/fakeroot/engine_linux.go | 5 +++++ internal/pkg/runtime/engine/oci/monitor_linux.go | 5 +++++ internal/pkg/runtime/engine/singularity/monitor_linux.go | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/internal/app/starter/master_linux.go b/internal/app/starter/master_linux.go index 66b957442c..c6bedb85b6 100644 --- a/internal/app/starter/master_linux.go +++ b/internal/app/starter/master_linux.go @@ -123,7 +123,9 @@ func Master(rpcSocket, masterSocket int, containerPid int, e *engine.Engine) { // we could receive signal from child with CreateContainer call so we // set the signal handler earlier to queue signals until MonitorContainer // is called to handle them - signals := make(chan os.Signal, 1) + // Use a channel size of two here, since we may receive SIGURG, which is + // used for non-cooperative goroutine preemption starting with Go 1.14. + signals := make(chan os.Signal, 2) signal.Notify(signals) ctx := context.TODO() diff --git a/internal/pkg/runtime/engine/fakeroot/engine_linux.go b/internal/pkg/runtime/engine/fakeroot/engine_linux.go index ae424decef..b2c83b6f0a 100644 --- a/internal/pkg/runtime/engine/fakeroot/engine_linux.go +++ b/internal/pkg/runtime/engine/fakeroot/engine_linux.go @@ -261,6 +261,11 @@ func (e *EngineOperations) MonitorContainer(pid int, signals chan os.Signal) (sy continue } return status, nil + case syscall.SIGURG: + // Ignore SIGURG, which is used for non-cooperative goroutine + // preemption starting with Go 1.14. For more information, see + // https://github.com/golang/go/issues/24543. + break default: if err := syscall.Kill(pid, s.(syscall.Signal)); err != nil { return status, fmt.Errorf("interrupted by signal %s", s.String()) diff --git a/internal/pkg/runtime/engine/oci/monitor_linux.go b/internal/pkg/runtime/engine/oci/monitor_linux.go index 3c9e5e7380..b0249cdcfd 100644 --- a/internal/pkg/runtime/engine/oci/monitor_linux.go +++ b/internal/pkg/runtime/engine/oci/monitor_linux.go @@ -36,6 +36,11 @@ func (e *EngineOperations) MonitorContainer(pid int, signals chan os.Signal) (sy continue } return status, nil + case syscall.SIGURG: + // Ignore SIGURG, which is used for non-cooperative goroutine + // preemption starting with Go 1.14. For more information, see + // https://github.com/golang/go/issues/24543. + break default: if err := syscall.Kill(pid, s.(syscall.Signal)); err != nil { return status, fmt.Errorf("interrupted by signal %s", s.String()) diff --git a/internal/pkg/runtime/engine/singularity/monitor_linux.go b/internal/pkg/runtime/engine/singularity/monitor_linux.go index e575fc4f29..bd4fe05a6f 100644 --- a/internal/pkg/runtime/engine/singularity/monitor_linux.go +++ b/internal/pkg/runtime/engine/singularity/monitor_linux.go @@ -48,6 +48,11 @@ func (e *EngineOperations) MonitorContainer(pid int, signals chan os.Signal) (sy continue } return status, nil + case syscall.SIGURG: + // Ignore SIGURG, which is used for non-cooperative goroutine + // preemption starting with Go 1.14. For more information, see + // https://github.com/golang/go/issues/24543. + break default: if e.EngineConfig.GetSignalPropagation() { if err := syscall.Kill(pid, s.(syscall.Signal)); err != nil {