Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions components/supervisor/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/gitpod-io/gitpod/common-go/process"
"github.com/gitpod-io/gitpod/supervisor/pkg/shared"
"github.com/gitpod-io/gitpod/supervisor/pkg/supervisor"
reaper "github.com/gitpod-io/go-reaper"
"github.com/prometheus/procfs"
reaper "github.com/ramr/go-reaper"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -114,18 +114,22 @@ var initCmd = &cobra.Command{
}
}()
// start the reaper to clean up zombie processes
reaperChan := make(chan reaper.Status, 10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the Go routine is just checking the PID for equality, and only forwards to handledByReaper in a single case, I think the small buffer of 10 is not leading to any blockages here. 👍

reaper.Start(reaper.Config{
Pid: -1,
Options: 0,
DisablePid1Check: false,
OnReap: func(pid int, wstatus syscall.WaitStatus) {
if pid != runCommand.Process.Pid {
return
StatusChannel: reaperChan,
})
go func() {
for status := range reaperChan {
if status.Pid != runCommand.Process.Pid {
continue
}
exitCode := wstatus.ExitStatus()
exitCode := status.WaitStatus.ExitStatus()
handledByReaper <- exitCode
},
})
}
}()

select {
case <-supervisorDone:
Expand Down
1 change: 1 addition & 0 deletions components/supervisor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ require (
github.com/prometheus/common v0.42.0
github.com/prometheus/procfs v0.10.1
github.com/prometheus/pushgateway v1.5.1
github.com/ramr/go-reaper v0.2.2
github.com/sirupsen/logrus v1.9.3
github.com/soheilhy/cmux v0.1.5
github.com/spf13/cobra v1.4.0
Expand Down
4 changes: 2 additions & 2 deletions components/supervisor/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading