Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put container's stdin behind TTY waitgroup. #1803

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kobolog
Copy link

@kobolog kobolog commented May 15, 2018

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:

``` Read at 0x00c4200b8060 by main goroutine: os.(*file).close() /usr/local/go1.8/src/os/file_unix.go:136 +0xa4 os.(*File).Close() /usr/local/go1.8/src/os/file_unix.go:132 +0x55 main.(*tty).Close() go/src/github.com/opencontainers/runc/tty.go:120 +0x114 main.(*runner).run() go/src/github.com/opencontainers/runc/utils_linux.go:310 +0x966 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

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

</details>

@cyphar
Copy link
Member

cyphar commented May 15, 2018

You need to add a Signed-off-by: line to your commit(s) which indicates that you attest the Developer Certificate of Origin a statement about your contributions that you must read before signing (don't worry, it's quite short and easy-to-read). You can add it to your commits with git commit --amend -s, and then doing a git push --force.

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.

Signed-off-by: Andrey Sibirev <kobolog@dropbox.com>
@kobolog kobolog closed this May 15, 2018
@kobolog kobolog deleted the kobolog/stdin-tty-wg branch May 15, 2018 22:42
@kobolog kobolog restored the kobolog/stdin-tty-wg branch May 15, 2018 22:43
@kobolog kobolog reopened this May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants