Skip to content

fix(shim/windows): retry on winio.ErrTimeout in awaitPipeReady - #13536

Merged
dmcgowan merged 1 commit into
containerd:mainfrom
eginez:dev/eginez/1104-fix-shim-windows-awaitpipeready-bails-on
Jun 16, 2026
Merged

dmcgowan merged 1 commit into
containerd:mainfrom
eginez:dev/eginez/1104-fix-shim-windows-awaitpipeready-bails-on

Conversation

@eginez

@eginez eginez commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Root cause

awaitPipeReady retried only on os.IsNotExist and context.DeadlineExceeded, but
winio.DialPipe returns winio.ErrTimeout — not context.DeadlineExceeded —
when the per-attempt timeout fires. A pipe in state 1 (ListenPipe called,
Accept not yet called) causes DialPipe to block for the 1-second per-attempt
timeout and return winio.ErrTimeout. The old check treated that as fatal and
returned immediately — discarding the rest of the 5-second budget.

Fix

// ERROR_PIPE_BUSY is handled internally by go-winio's tryDialPipe
// loop and surfaces as winio.ErrTimeout once the per-attempt timeout
// deadline fires; the explicit ERROR_PIPE_BUSY branch is a guard.
retryable := os.IsNotExist(err) ||
    errors.Is(err, winio.ErrTimeout) ||
    errors.Is(err, windows.ERROR_PIPE_BUSY)
if !retryable {
    return err
}

Matches the error checks from containerd/nerdbox#218.

Tests

Added shim_windows_await_test.go:

  • TestAwaitPipeReady_State1_RetriesOnErrTimeout: server listens immediately but
    delays Accept by 1.5 s (longer than the 1-second per-attempt timeout, forcing
    ErrTimeout) — must succeed by retrying

Same bug class fixed in nerdbox: containerd/nerdbox#218

Copilot AI review requested due to automatic review settings June 5, 2026 23:38
@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review Jun 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the Windows named-pipe readiness check to treat winio.ErrTimeout as retryable and adds a regression test covering the pipe “state 1” timeout behavior.

Changes:

  • Update awaitPipeReady to retry when winio.DialPipe returns winio.ErrTimeout instead of failing immediately.
  • Add a Windows-only test that reproduces the “listener created but Accept not yet called” timeout scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/shim/shim_windows.go Adjusts retry logic in awaitPipeReady to consider winio.ErrTimeout retryable.
pkg/shim/shim_windows_await_test.go Adds a regression test validating retries when dialing a state-1 named pipe times out.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/shim/shim_windows.go Resolved
Comment thread pkg/shim/shim_windows_test.go Resolved
Copilot AI review requested due to automatic review settings June 5, 2026 23:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread pkg/shim/shim_windows_test.go Resolved
Comment thread pkg/shim/shim_windows_test.go Resolved
@eginez
eginez force-pushed the dev/eginez/1104-fix-shim-windows-awaitpipeready-bails-on branch from 0cd1722 to e0287bf Compare June 8, 2026 15:57
@eginez
eginez force-pushed the dev/eginez/1104-fix-shim-windows-awaitpipeready-bails-on branch from ee02c90 to e1aa8a1 Compare June 8, 2026 16:09
Copilot AI review requested due to automatic review settings June 8, 2026 16:27
@eginez
eginez force-pushed the dev/eginez/1104-fix-shim-windows-awaitpipeready-bails-on branch from e1aa8a1 to b5a393a Compare June 8, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread pkg/shim/shim_windows.go Resolved
Comment thread pkg/shim/shim_windows_test.go Resolved
@eginez
eginez force-pushed the dev/eginez/1104-fix-shim-windows-awaitpipeready-bails-on branch from 28e2c65 to b5a393a Compare June 8, 2026 21:18
@dmcgowan
dmcgowan requested a review from austinvazquez June 9, 2026 17:26
Comment thread pkg/shim/shim_windows_test.go Resolved
Comment thread pkg/shim/shim_windows.go Resolved
Comment thread pkg/shim/shim_windows_await_test.go Resolved
awaitPipeReady retried only when DialPipe returned os.IsNotExist or
context.DeadlineExceeded, but winio.DialPipe converts the per-attempt
deadline into winio.ErrTimeout before returning. A pipe in state 1
(ListenPipe called, Accept not yet called) causes DialPipe to block for
the full per-attempt timeout and return winio.ErrTimeout, which the old
check treated as a fatal error instead of retrying.

Also guard windows.ERROR_PIPE_BUSY explicitly to match the error checks
in containerd/nerdbox#218.

Adds a regression test that forces the state-1 to state-2 transition
race by delaying Accept past the 1-second per-attempt timeout.

Signed-off-by: Esteban Ginez <[email protected]>
@eginez
eginez force-pushed the dev/eginez/1104-fix-shim-windows-awaitpipeready-bails-on branch from b5a393a to be3fcf3 Compare June 10, 2026 21:51
@eginez
eginez requested a review from austinvazquez June 10, 2026 21:57
@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review Jun 11, 2026
@dmcgowan
dmcgowan added this pull request to the merge queue Jun 16, 2026
Merged via the queue into containerd:main with commit b6aca07 Jun 16, 2026
87 of 88 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Jun 16, 2026
@dmcgowan dmcgowan added the cherry-pick/2.3.x Change to be cherry picked to release/2.3 label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick/2.3.x Change to be cherry picked to release/2.3 size/M

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants