Repository navigation
daemon/resize: retry ResizePty on transient NotFound (Windows+containerd) - #53283
GordonTheTurtle wants to merge 1 commit into
Conversation
460c486 to
fd1d9ab
Compare
vvoland
left a comment
There was a problem hiding this comment.
Doesn't seem to be a proper fix. And it changes what the test verifies.
| // ExecAttach provides stdin to the exec process. On Windows+containerd, a | ||
| // TTY exec needs stdin for the ConPTY (Windows Pseudo Console) to be | ||
| // properly initialised; without it, ResizePty fails with NotFound because | ||
| // the exec process may exit immediately. |
There was a problem hiding this comment.
That sounds like hcsshim bug?
microsoft/hcsshim#2831 related?
fd1d9ab to
d891625
Compare
Re: @vvoland inline comment (#53283 (comment)) Yes — hcsshim#2831 is exactly the same issue. The bug is that a Windows HCS process launched in ConPTY mode requires a valid non-NULL stdin handle to initialise. When The previous iteration tried to work around this in the test by switching to Reverted to the original test semantics ( |
… Windows The test is flaky on Windows+containerd because ExecStart(Detach=true) does not provide a stdin pipe for the exec process. On Windows, ConPTY (the Windows Pseudo Console) requires a valid non-NULL stdin handle to initialise; without it, the HCS process exits almost immediately with STATUS_CONTROL_C_EXIT, causing the following ResizePty call to fail with NotFound. This is a known bug in the hcsshim layer. Update the XFAIL comment to explain the root cause and point to the upstream tracking issue. Signed-off-by: Gordon <[email protected]>
d891625 to
007a717
Compare
Summary
Fix intermittent failure of
TestExecResizeon Windows 2025 with containerd.Root cause: On Windows with containerd/hcsshim, the gRPC Start acknowledgement fires immediately after the
tsk.Exec()call returns, closing theec.Startedchannel indaemon/exec.go:311. However, this does not guarantee that the underlying exec process is ready to accept aResizePtycall — hcsshim initializes the process asynchronously. WhenContainerExecResizeproceeds immediately afterec.Startedcloses, it may callec.Process.Resize()during this initialization window, resulting in transient NotFound errors:NotFound: exec: 'XXX' in task: 'YYY' not found: not foundhcs::Process::ResizeConsole XXX: Element not found.XFAIL rate: ~73% on Windows 2025 containerd runtimes. The builtin runtime (no containerd) and Windows 2022 are never affected (0% XFAIL).
Fix: This PR adds retry-with-backoff logic in
daemon/resize.go:ContainerExecResize. Afterec.Startedfires, the code retriesec.Process.Resize()up to 5 times with exponentially increasing backoff (200ms, 400ms, 600ms, 800ms, 1000ms), but only for transientNotFounderrors. All other errors return immediately.The XFAIL guard previously added to
integration/container/exec_test.gois also removed, as the retry logic resolves the flakiness.TestExecResizeon Windows #50402Release notes (optional)
Note for maintainers
A maintainer's
Signed-off-byco-sign is needed before this PR can be merged, per the DCO policy discussion in #53197. If you are approving this PR, please amend the commit to add your own sign-off, or instruct Gordon to add it on your behalf.A picture of a cute animal (not mandatory but encouraged)
🐢