Skip to content

Conversation

grey3228
Copy link

Hello!

I've noticed that in utils_linux.go/setupIO connection conn may not be closed in some scenarios. I'm not sure how likely these scenarios are in practice but still want to highlight it and add explicit close.

Manually close conn in setupIO in cases when

  1. *net.UnixConn type assertion failed;
  2. fd wasn't created.

Manually close conn in setupIO in cases when
1) *net.UnixConn type assertion failed;
2) fd wasn't created.

Signed-off-by: Mikhail Dmitrichenko <[email protected]>
@@ -123,11 +123,13 @@ func setupIO(process *libcontainer.Process, container *libcontainer.Container, c
}
uc, ok := conn.(*net.UnixConn)
if !ok {
conn.Close()
Copy link
Member

Choose a reason for hiding this comment

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

This cannot fail, and to be honest the following error should be a panic imho.

@kolyshkin
Copy link
Contributor

A duplicate of #4780?

@grey3228
Copy link
Author

Yes, duplicate. Sorry. I'm closing this PR then.

@grey3228 grey3228 closed this Jul 29, 2025
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