Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The UnixStream has an FD leakage problem. #1635

Closed
3 tasks
silence-coding opened this issue Nov 25, 2022 · 4 comments · Fixed by #1636
Closed
3 tasks

The UnixStream has an FD leakage problem. #1635

silence-coding opened this issue Nov 25, 2022 · 4 comments · Fixed by #1636

Comments

@silence-coding
Copy link

silence-coding commented Nov 25, 2022

The UnixStream has an FD leakage problem.

When the socket_addr error occurs, the socket is not released.

    let socket = new_socket(libc::AF_UNIX, libc::SOCK_STREAM)?;
    let (sockaddr, socklen) = socket_addr(path)?;
    let sockaddr = &sockaddr as *const libc::sockaddr_un as *const libc::sockaddr;
@Thomasdezeeuw
Copy link
Collaborator

Yup, good find.

@Thomasdezeeuw
Copy link
Collaborator

I imagine most UDS implementations are the same. I'll take a look at them

@silence-coding
Copy link
Author

I took a look and found two places. Why not follow the standard library? When the socket is created, it returns a wrapper object, which is released in the drop method of the object.

@silence-coding
Copy link
Author

I imagine most UDS implementations are the same. I'll take a look at them

Thank you for your reply

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 a pull request may close this issue.

2 participants