Skip to content

Commit 9442b52

Browse files
authored
[supervisor] switch lib back to use upstream ramr/go-reaper (#20322)
1 parent 9e8da3b commit 9442b52

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

components/supervisor/cmd/init.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"github.com/gitpod-io/gitpod/common-go/process"
2323
"github.com/gitpod-io/gitpod/supervisor/pkg/shared"
2424
"github.com/gitpod-io/gitpod/supervisor/pkg/supervisor"
25-
reaper "github.com/gitpod-io/go-reaper"
2625
"github.com/prometheus/procfs"
26+
reaper "github.com/ramr/go-reaper"
2727
"github.com/spf13/cobra"
2828
)
2929

@@ -114,18 +114,22 @@ var initCmd = &cobra.Command{
114114
}
115115
}()
116116
// start the reaper to clean up zombie processes
117+
reaperChan := make(chan reaper.Status, 10)
117118
reaper.Start(reaper.Config{
118119
Pid: -1,
119120
Options: 0,
120121
DisablePid1Check: false,
121-
OnReap: func(pid int, wstatus syscall.WaitStatus) {
122-
if pid != runCommand.Process.Pid {
123-
return
122+
StatusChannel: reaperChan,
123+
})
124+
go func() {
125+
for status := range reaperChan {
126+
if status.Pid != runCommand.Process.Pid {
127+
continue
124128
}
125-
exitCode := wstatus.ExitStatus()
129+
exitCode := status.WaitStatus.ExitStatus()
126130
handledByReaper <- exitCode
127-
},
128-
})
131+
}
132+
}()
129133

130134
select {
131135
case <-supervisorDone:

components/supervisor/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ require (
3030
github.com/prometheus/common v0.42.0
3131
github.com/prometheus/procfs v0.10.1
3232
github.com/prometheus/pushgateway v1.5.1
33+
github.com/ramr/go-reaper v0.2.2
3334
github.com/sirupsen/logrus v1.9.3
3435
github.com/soheilhy/cmux v0.1.5
3536
github.com/spf13/cobra v1.4.0

components/supervisor/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)