containerd / containerd/go-runc

calling create without file stdio blocks

Open
#31 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
176
Forks
81
Avg merge
1d 19h
Merged PRs (30d)
6

Description

`os/exec` allows 2 ways to wait on command: `Cmd.Wait()` makes sure all the goroutines that can be created by `Cmd.Start()` are cleaned up and doesn't return before stdio is closed. `Process.Wait()` returns after the process has exited but leaks goroutines. Previously `monitor.Wait()` in this package waited only for process but was changed to fix those leaks.

Problem is that there is one command `Create()` that by design takes stdio, forwards it to its children and then exits itself. That means that `Cmd.Wait()` does not return because the attach stdio has not finished. In containerd this does not appear because the interfaces passed in are always regular files(fifos) and don't create extra goroutines in `os/exec` internals.

I'd recommend either changing `CreateOpt` to take `*io.File` or implementing pipe copy in this library so it can be cleaned up outside of stdlib(that would probably mean adding a cleanup function to the IO interface).

@crosbymichael

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.