Skip to content

Commit

Permalink
trigger child reaper on start (#3487)
Browse files Browse the repository at this point in the history
by seeding the incoming channel. This is required to collect the zombies created by switch-root.
  • Loading branch information
caglar10ur authored Dec 13, 2016
1 parent de38d74 commit 511497f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/tether/tether.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ func (t *tether) setup() error {
log.Errorf("Unable to open PID file for %s : %s", os.Args[0], err)
}

// seed the incoming channel once to trigger child reaper. This is required to collect the zombies created by switch-root
t.triggerReaper()

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions lib/tether/tether_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func (t *tether) stopReaper() {
defer trace.End(trace.Begin("Shutting down child reaping"))
}

func (t *tether) triggerReaper() error {
return errors.New("Child reaping unimplemented on OSX")
}

// processEnvOS does OS specific checking and munging on the process environment prior to launch
func (t *tether) processEnvOS(env []string) []string {
// TODO: figure out how we're going to specify user and pass all the settings along
Expand Down
6 changes: 6 additions & 0 deletions lib/tether/tether_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ func (t *tether) stopReaper() {
close(t.incoming)
}

func (t *tether) triggerReaper() {
defer trace.End(trace.Begin("Triggering child reaping"))

t.incoming <- syscall.SIGCHLD
}

func findExecutable(file string) error {
d, err := os.Stat(file)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions lib/tether/tether_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func (t *tether) stopReaper() {
defer trace.End(trace.Begin("Shutting down child reaping"))
}

func (t *tether) triggerReaper() error {
return errors.New("Child reaping unimplemented on windows")
}

func lookPath(file string, env []string, dir string) (string, error) {
return "", errors.New("unimplemented on windows")
}
Expand Down

0 comments on commit 511497f

Please sign in to comment.