From 2f341738a195da63354573e4d50f3e9819e597bd Mon Sep 17 00:00:00 2001 From: James Phillips Date: Wed, 9 Nov 2016 09:52:07 -0800 Subject: [PATCH] Removes stale reference to reap lock which causes a panic. (#2490) --- command/agent/check.go | 7 ------- command/agent/check_test.go | 5 ----- 2 files changed, 12 deletions(-) diff --git a/command/agent/check.go b/command/agent/check.go index 6564a39fd7..5573d4008c 100644 --- a/command/agent/check.go +++ b/command/agent/check.go @@ -110,7 +110,6 @@ type CheckMonitor struct { Interval time.Duration Timeout time.Duration Logger *log.Logger - ReapLock *sync.RWMutex stop bool stopCh chan struct{} @@ -156,12 +155,6 @@ func (c *CheckMonitor) run() { // check is invoked periodically to perform the script check func (c *CheckMonitor) check() { - // Disable child process reaping so that we can get this command's - // return value. Note that we take the read lock here since we are - // waiting on a specific PID and don't need to serialize all waits. - c.ReapLock.RLock() - defer c.ReapLock.RUnlock() - // Create the command cmd, err := ExecScript(c.Script) if err != nil { diff --git a/command/agent/check_test.go b/command/agent/check_test.go index 72ecfac285..749a8351dc 100644 --- a/command/agent/check_test.go +++ b/command/agent/check_test.go @@ -11,7 +11,6 @@ import ( "os" "os/exec" "strings" - "sync" "testing" "time" @@ -46,7 +45,6 @@ func expectStatus(t *testing.T, script, status string) { Script: script, Interval: 10 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), - ReapLock: &sync.RWMutex{}, } check.Start() defer check.Stop() @@ -96,7 +94,6 @@ func TestCheckMonitor_Timeout(t *testing.T) { Interval: 10 * time.Millisecond, Timeout: 5 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), - ReapLock: &sync.RWMutex{}, } check.Start() defer check.Stop() @@ -125,7 +122,6 @@ func TestCheckMonitor_RandomStagger(t *testing.T) { Script: "exit 0", Interval: 25 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), - ReapLock: &sync.RWMutex{}, } check.Start() defer check.Stop() @@ -154,7 +150,6 @@ func TestCheckMonitor_LimitOutput(t *testing.T) { Script: "od -N 81920 /dev/urandom", Interval: 25 * time.Millisecond, Logger: log.New(os.Stderr, "", log.LstdFlags), - ReapLock: &sync.RWMutex{}, } check.Start() defer check.Stop()