Closed lifupan closed 6 years ago
IMO runc is same.
The best way to run a process background in a container is docker exec -tid sleep 10000
.
Hi @caoruidong No, I cannot reproduce this issue on runc using docker. Actually runc/runc-shim can close the terminal successfully even there is background child process running.
Hi @lifupan - as the template requested, please can you paste the output of sudo kata-collect-data.sh
as a comment here so we can understand your environment?
@lifupan Sorry, you're right. I test with an old version of docker.
Description of problem
When exec a shell process and then run a background process in it, and then exit this shell, it will hang there waiting the terminal close.
How to reproduce: 1: id=
sudo docker run -d busybox top
2: sudo docker exec -ti $id sh 3: run "sleep 10000 &" in the container 4: run "exit"The "exit" will not exit successfully and it will wait there.
The root cause is that, kata assumes once a process exits, its io/terminal will also be closed, once the kata client received the io closed, it will then wait on the process to clean it up. But the problem is that if a child process is run as background and it will also inherit its parent's terminal, thus even the parent process exits, it's terminal will not closed, thus the kata client will wait on the terminal for ever.
Expected result
(replace this text with an explanation of what you thought would happen)
Actual result
(replace this text with details of what actually happened)
$ sudo kata-collect-data.sh
Meta details
Running
kata-collect-data.sh
version1.2.0 (commit a39a3f15a3c996648248de28be8719f17604fded)
at2018-09-14.15:38:58.657470931+0800
.Runtime is
/usr/local/bin/kata-runtime
.kata-env
Output of "
/usr/local/bin/kata-runtime kata-env
":Runtime config files
Runtime default config files
Runtime config file contents
Config file
/etc/kata-containers/configuration.toml
not found Output of "cat "/usr/share/defaults/kata-containers/configuration.toml"
":Image details
No image
Initrd details
Logfiles
Runtime logs
Recent runtime problems found in system journal:
Proxy logs
Recent proxy problems found in system journal:
Shim logs
No recent shim problems found in system journal.
Container manager details
Have
docker
Docker
Output of "
docker version
":Output of "
docker info
":Output of "
systemctl show docker
":No
kubectl
Packages
Have
dpkg
Output of "dpkg -l|egrep "(cc-oci-runtimecc-runtimerunv|kata-proxy|kata-runtime|kata-shim|kata-containers-image|linux-container|qemu-)"
":Have
rpm
Output of "rpm -qa|egrep "(cc-oci-runtimecc-runtimerunv|kata-proxy|kata-runtime|kata-shim|kata-containers-image|linux-container|qemu-)"
":