Put container's stdin behind TTY waitgroup. #1803
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a race between
runc run
closing stdin on exit and TTY copier goroutine also trying to close it because of EOF on the console:Previous write at 0x00c4200b8060 by goroutine 9:
os.(*file).close()
/usr/local/go1.8/src/os/file_unix.go:143 +0x10a
os.(*File).Close()
/usr/local/go1.8/src/os/file_unix.go:132 +0x55
main.setupProcessPipes.func1()
go/src/github.com/opencontainers/runc/tty.go:57 +0xcc
Goroutine 9 (finished) created at:
main.setupProcessPipes()
go/src/github.com/opencontainers/runc/tty.go:58 +0x510
main.setupIO()
go/src/github.com/opencontainers/runc/utils_linux.go:163 +0x26e
main.(*runner).run()
go/src/github.com/opencontainers/runc/utils_linux.go:264 +0x6b5
main.startContainer()
go/src/github.com/opencontainers/runc/utils_linux.go:395 +0x4ff
main.glob..func13()
go/src/github.com/opencontainers/runc/run.go:76 +0xe3
runtime.call32()
/usr/local/go1.8/src/runtime/asm_amd64.s:514 +0x47
reflect.Value.Call()
/usr/local/go1.8/src/reflect/value.go:302 +0xc0
github.com/urfave/cli.HandleAction()
go/src/github.com/urfave/cli/app.go:487 +0x22d
github.com/urfave/cli.Command.Run()
go/src/github.com/urfave/cli/command.go:191 +0xdee
github.com/urfave/cli.(*App).Run()
go/src/github.com/urfave/cli/app.go:240 +0x8eb
main.main()
go/src/github.com/opencontainers/runc/main.go:138 +0x1249