Skip to content

Commit

Permalink
stress2: notes on process cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aclements committed Oct 3, 2024
1 parent 2f6ede8 commit 7f9fb08
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions stress2/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ import (
//
// TODO(test): Test these situations.

// TODO: Use PR_SET_CHILD_SUBREAPER on Linux to keep track of the
// whole subprocess tree.

// TODO: We could use PID namespaces plus a custom init process that
// exits of stress exits to ensure the subprocess tree gets cleaned up
// if stress exits. However, we can only do this with root privileges.

type Command struct {
// Status contains the process exit status after the process is done.
Status *os.ProcessState
Expand Down Expand Up @@ -71,10 +78,6 @@ func StartCommand(args []string, out io.Writer) (*Command, error) {
//
// For other signals, there's simply not much we can do about
// cleaning up children.
//
// TODO: On Linux, use PID namespaces if possible plus a
// custom init process that exits if stress exits so we really
// can reliably clean things up.
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
Expand Down

0 comments on commit 7f9fb08

Please sign in to comment.