Skip to content

container: don't copy stdin from a background TTY - #7249

Open
locker95 wants to merge 1 commit into
docker:masterfrom
locker95:fix/no-stdin-copy-when-backgrounded
Open

container: don't copy stdin from a background TTY#7249
locker95 wants to merge 1 commit into
docker:masterfrom
locker95:fix/no-stdin-copy-when-backgrounded

Conversation

@locker95

Copy link
Copy Markdown

docker run -i ... & still has stdin pointed at the terminal. reading that from a background process group raises SIGTTIN, and because we catch every signal (to forward them) the default "stop in the background" never happens — the read just retries and the CLI sits at 100% cpu.

if we're not the foreground pgrp, skip the stdin copy. also stop forwarding TTIN/TTOU.

Fixes #6005

`docker run -i ... &` keeps stdin as the controlling terminal. Reading
it from a background process group raises SIGTTIN, which the CLI
swallows because it catches every signal for forwarding, so the read
retries in a tight loop.

Skip the stdin copy when we are not the foreground pgrp, and do not
forward TTIN/TTOU to the container.

Fixes docker#6005

Signed-off-by: Dean Chen <862469039@qq.com>
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.

High CPU usage when backgrounding CLI with -i

1 participant