deps: update go-plugin to 1.6.2 (#24265)

During allocation recovery, the go-plugin reattachment workflow checks to see if
the PID we stored in client state is still running. If so, we try to connect to
that process. If that fails, we kill the process under the presumption it's not
working. But during reattachment we don't know that the PID we have is still
valid. Which means that the process we're trying to attach to may have exited
and a different process has spawned with the same PID. This results in some
unrelated process getting silently killed.

Update go-plugin to 1.6.2, which includes a bug fix so we do not kill the
process.

Fixes: https://github.com/hashicorp/nomad/issues/23969
This commit is contained in:
Tim Gross
2024-10-21 15:48:26 -04:00
committed by GitHub
parent 11573fba89
commit 6d17a9bf64
4 changed files with 9 additions and 6 deletions

3
.changelog/24265.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
deps: Fixed a bug where restarting Nomad could cause an unrelated process with the same PID as a failed executor to be killed
```

2
go.mod
View File

@@ -66,7 +66,7 @@ require (
github.com/hashicorp/go-msgpack/v2 v2.1.2 github.com/hashicorp/go-msgpack/v2 v2.1.2
github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-netaddrs v0.1.0 github.com/hashicorp/go-netaddrs v0.1.0
github.com/hashicorp/go-plugin v1.6.1 github.com/hashicorp/go-plugin v1.6.2
github.com/hashicorp/go-secure-stdlib/listenerutil v0.1.9 github.com/hashicorp/go-secure-stdlib/listenerutil v0.1.9
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 github.com/hashicorp/go-secure-stdlib/strutil v0.1.2
github.com/hashicorp/go-set/v3 v3.0.0-alpha.1 github.com/hashicorp/go-set/v3 v3.0.0-alpha.1

4
go.sum
View File

@@ -689,8 +689,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-netaddrs v0.1.0 h1:TnlYvODD4C/wO+j7cX1z69kV5gOzI87u3OcUinANaW8= github.com/hashicorp/go-netaddrs v0.1.0 h1:TnlYvODD4C/wO+j7cX1z69kV5gOzI87u3OcUinANaW8=
github.com/hashicorp/go-netaddrs v0.1.0/go.mod h1:33+a/emi5R5dqRspOuZKO0E+Tuz5WV1F84eRWALkedA= github.com/hashicorp/go-netaddrs v0.1.0/go.mod h1:33+a/emi5R5dqRspOuZKO0E+Tuz5WV1F84eRWALkedA=
github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= github.com/hashicorp/go-plugin v1.6.2 h1:zdGAEd0V1lCaU0u+MxWQhtSDQmahpkwOun8U8EiRVog=
github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= github.com/hashicorp/go-plugin v1.6.2/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=

View File

@@ -9,6 +9,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"testing"
"time" "time"
hclog "github.com/hashicorp/go-hclog" hclog "github.com/hashicorp/go-hclog"
@@ -25,7 +26,6 @@ import (
"github.com/hashicorp/nomad/plugins/drivers" "github.com/hashicorp/nomad/plugins/drivers"
"github.com/hashicorp/nomad/plugins/drivers/fsisolation" "github.com/hashicorp/nomad/plugins/drivers/fsisolation"
"github.com/hashicorp/nomad/plugins/shared/hclspec" "github.com/hashicorp/nomad/plugins/shared/hclspec"
testing "github.com/mitchellh/go-testing-interface"
"github.com/shoenig/test/must" "github.com/shoenig/test/must"
) )
@@ -33,7 +33,7 @@ type DriverHarness struct {
drivers.DriverPlugin drivers.DriverPlugin
client *plugin.GRPCClient client *plugin.GRPCClient
server *plugin.GRPCServer server *plugin.GRPCServer
t testing.T t *testing.T
logger hclog.Logger logger hclog.Logger
impl drivers.DriverPlugin impl drivers.DriverPlugin
cgroup string cgroup string
@@ -42,7 +42,7 @@ type DriverHarness struct {
func (h *DriverHarness) Impl() drivers.DriverPlugin { func (h *DriverHarness) Impl() drivers.DriverPlugin {
return h.impl return h.impl
} }
func NewDriverHarness(t testing.T, d drivers.DriverPlugin) *DriverHarness { func NewDriverHarness(t *testing.T, d drivers.DriverPlugin) *DriverHarness {
logger := testlog.HCLogger(t).Named("driver_harness") logger := testlog.HCLogger(t).Named("driver_harness")
pd := drivers.NewDriverPlugin(d, logger) pd := drivers.NewDriverPlugin(d, logger)