shim: don't tear down shared pod UVM on Hyper-V container restart - #2846
shim: don't tear down shared pod UVM on Hyper-V container restart#2846Dawei Wei (rzlink) wants to merge 1 commit into
Conversation
65fd990 to
808e988
Compare
|
Dawei Wei (@rzlink) |
Thanks. This is for Kubernetes |
On Hyper-V-isolated Windows pods (runhcs-wcow-hypervisor), in-place container restarts (ContainerRestartRules / RestartAllContainersOnContainerExits) fail: when a workload container exits it is not restarted in place; the pod ends up Failed. Two hcsshim/GCS issues combine to destroy the shared pod UVM. 1. Under RestartAll churn the guest GCS delivers a container's WaitForProcess exit reply late (or drops it); a crossing SIGKILL then returns hrNotFound while the wait is still pending. Process.Signal only logged "ignoring missing process", so the wait never completed and container Stop blocked forever. Force-complete the pending wait on hrNotFound so Wait()/Stop can't hang, and make an unmatched late response in recvLoop non-fatal (log and continue) rather than tearing the bridge down. 2. The KillExec 30s SIGKILL-init watchdog closed ht.host directly with no ownsHost guard, so a non-owning workload container's stuck stop tore down the shared pod UVM, killing the sandbox and its siblings. Gate the watchdog on ht.ownsHost and route teardown through closeHost so only the UVM owner may close it. Process-isolated pods are unaffected (host HCS exit path, no shared UVM). Adds unit tests for bridge.forceComplete and the non-fatal unknown-rpc path. Signed-off-by: Dawei Wei <wei.dawei.cn@gmail.com>
808e988 to
0125160
Compare
| // timer and wait on either the timer expiring or the process exiting | ||
| // cleanly. If the timer expires first we forcibly close the UVM as we | ||
| // assume the guest is misbehaving for some reason. | ||
| if signal == 0x9 && eid == "" && ht.host != nil && ht.ownsHost { |
There was a problem hiding this comment.
the forceComplete call should unblock execExited and render this change unneeded, right?
Description
Fix in-place container restarts for Hyper-V-isolated Windows pods.
Two issues could combine to destroy the shared pod UVM:
SignalProcessreturnedhrNotFoundwhileWaitForProcessremained pending, process shutdown could block indefinitely. Force-complete the pending wait and tolerate its possible late response.ownsHostand usecloseHostfor teardown.This prevents a workload container restart from terminating the sandbox and sibling containers sharing the UVM.
Testing
go test ./internal/gcs