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

exec(tty=true) process leak when restart containerd #8856

Open
yuqitao opened this issue Jul 21, 2023 · 3 comments · May be fixed by #10082
Open

exec(tty=true) process leak when restart containerd #8856

yuqitao opened this issue Jul 21, 2023 · 3 comments · May be fixed by #10082
Assignees
Labels

Comments

@yuqitao
Copy link

yuqitao commented Jul 21, 2023

Description

restart containerd if there are some exec(tty=true) processes,like crictl exec -it container-id bash,the shim-v2 does not release stdin fifo fd for exec process and the exec process bash leak.

Steps to reproduce the issue

  1. Terminal 1: crictl exec -it container-id bash
  2. Terminal 2: systemctl restart containerd

Describe the results you received and expected

expected:

  1. bash process exit;
  2. shim-v2 process release stdin FIFO fd;

received:

  1. bash process leak;
  2. shim-v2 process does not release stdin FIFO fd;

What version of containerd are you using?

main branch

Any other relevant information

No response

Show configuration if it is related to CRI plugin.

No response

@Iceber
Copy link
Member

Iceber commented Jul 21, 2023

Very interesting issue, I think containerd cri need clean them up after restart.

I think the process created by crictl/kubectl exec should have the same lifecycle as the stream connection.

The current CRI plugin will keep waiting for the process to exit even if the connection is disconnected, this design also causes the exec sh process to leak

@Iceber Iceber self-assigned this Jul 21, 2023
@Iceber
Copy link
Member

Iceber commented Jul 21, 2023

It's not just containerd restarts that cause exec processes to leak,kubectl exec and crictl exec that don't use the -ti flags, and use CTRL-C will cause exec processes to still be running. These processes can never be exited

@mark-cjh
Copy link

Any exec without -d option will leak after containerd restart. It happens because exec client stop opening namedpipe and shim doesn't know that. I think a notify mechanism should be implemented, so that shim can close usingless exec actively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants