Skip to content

Swap to net.ErrClosed checks for services#7446

Merged
mxpv merged 1 commit intocontainerd:mainfrom
dcantah:net-errclosed
Sep 29, 2022
Merged

Swap to net.ErrClosed checks for services#7446
mxpv merged 1 commit intocontainerd:mainfrom
dcantah:net-errclosed

Conversation

@dcantah
Copy link
Copy Markdown
Member

@dcantah dcantah commented Sep 29, 2022

In Go 1.16 net.ErrClosed was exported, removing the need to check the exact text of "use of closed network connection". The stdlib's net listeners are all setup for this to be a reality, but on Windows containerd uses the the go-winio projects named pipe implementation as the listener for services. Before version 0.6.0 this project returned a different error named ErrPipeListenerClosed for using a closed pipe, where this error was just an errors.New with the same text as net.ErrClosed, so checking against net.ErrClosed wasn't possible.

Starting in 0.6.0 go-winio has that error assigned to net.ErrClosed directly so this should be alright to finally change.

In Go 1.16 `net.ErrClosed` was exported, removing the need to check the
exact text of "use of closed network connection". The stdlib's net listeners
are all setup for this to be a reality, but on Windows containerd uses the
the go-winio projects named pipe implementation as the listener for services.
Before version 0.6.0 this project returned a different error named
`ErrPipeListenerClosed` for using a closed pipe, where this error was just
an `errors.New` with the same text as `net.ErrClosed`, so checking against
`net.ErrClosed` wasn't possible.

Starting in 0.6.0 go-winio has that error assigned to `net.ErrClosed` directly
so this *should* be alright to finally change.

Signed-off-by: Daniel Canter <[email protected]>
@mxpv mxpv merged commit d71fbcf into containerd:main Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants