Open inoc603 opened 7 years ago
Why do you think this is not the correct functionality? When a context closes, that means the request or parent crashed/ended so we don't want to orphan the runc process.
Yes the runc process should be killed when the context closes. My point is that it should be killed by SIGTERM
rather than SIGKILL
, so runc itself can clean up the exec process in the container. Current mechanism will orphan the exec process inside the container.
What I'm suggesting is listening for ctx.Done()
manually, instead of letting the exec
package handle it.
@inoc603 ok, the hard part is that Go is the one that sends the SIGKILL
. We would have to rewrite all the logic for CommandContext
to make this work like you said.
Closed #28 for staleness, is this issue still relevant though?
In
runc.Exec
, here the exec command is created withexec.CommandContext
, which will kill therunc
command withos.Process.Kill
when the context is done. And whenrunc
is killed bySIGKILL
, the exec process inside the container is not stopped. I think we should sendSIGTERM
manually to stop therunc
command when we're doing exec.I only tested this with
docker-runc
. Can anyone confirm whether it is the same withrunc
?