Commit 39d705b
Shreyansh Sancheti
shim: handle connection-closed errors during kill after live migration
After HCS live migration completes, FinalizeSourceLM tries to stop the
source sandbox via containerd. The shim's Kill call fails with
'ttrpc: closed' because the VM has already departed and the connection
(ttrpc transport or GCS bridge) is dead. This error propagates up as a
StopSourceVMFailure, even though the VM is already gone.
Three fixes:
1. exec_hcs: Treat ttrpc.ErrClosed and net.ErrClosed as successful kill.
If the connection is dead, the process is effectively gone. The
isConnectionClosed helper covers both the ttrpc transport path
(containerd-to-shim) and the GCS bridge path (shim-to-guest vsock).
2. uvm: Make CloseCtx idempotent via sync.Once. Three goroutines can
race to close the UVM (waitForHostExit, waitInitExit, KillExec
timer). Without idempotency, the second caller panics on
double-close of outputProcessingDone channel.
3. task_hcs: Route KillExec 30s timeout through closeHost instead of
calling ht.host.Close() directly. The direct call bypassed
closeHostOnce, skipping TaskExitEventTopic publish and ht.closed
channel close.
Fixes: #61773098
Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>1 parent 25abbc6 commit 39d705b
4 files changed
Lines changed: 33 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
307 | | - | |
| 310 | + | |
308 | 311 | | |
309 | 312 | | |
310 | 313 | | |
| |||
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
331 | 341 | | |
332 | 342 | | |
333 | 343 | | |
| |||
341 | 351 | | |
342 | 352 | | |
343 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
344 | 361 | | |
345 | 362 | | |
346 | 363 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
462 | | - | |
463 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
218 | 225 | | |
219 | 226 | | |
220 | 227 | | |
221 | 228 | | |
222 | 229 | | |
223 | | - | |
224 | | - | |
225 | 230 | | |
226 | 231 | | |
227 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
0 commit comments