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 |
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?
There was a problem hiding this comment.
Yes, forceComplete handles this specific hang. I kept ownsHost as a safety invariant so a workload task can never tear down its shared UVM if e.Wait() stalls for another reason.
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. Ignore an unmatched late WaitForProcess response without weakening fatal handling for other unknown RPC responses. 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 bridge-level and process-level regression tests for the missing-process race, late WaitForProcess response, and strict handling of other unknown RPCs. Signed-off-by: Dawei Wei <wei.dawei.cn@gmail.com>
0125160 to
6543d7c
Compare
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