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

File descriptor handlers leak on fork + exec #555

Open
feliperuiz opened this issue Oct 30, 2017 · 0 comments · May be fixed by #558
Open

File descriptor handlers leak on fork + exec #555

feliperuiz opened this issue Oct 30, 2017 · 0 comments · May be fixed by #558

Comments

@feliperuiz
Copy link

feliperuiz commented Oct 30, 2017

When forking and execing, file descriptors get leaked to the child process, which is not always ideal. One can always call fcntl and set O_CLOEXEC after establishing a connection, but this can lead to race conditions if a different thread is trying to fork.

Apart from OS compatibility, are there any cases where one might want this sort of behaviour, meaning the sockets couldn't be created with SOCK_CLOEXEC? If so, how could we implement some sort of flag or another Connect* in order to accommodate for that?

I've been bitten by this at work and I went with calling fcntl, but I'd like to have a more atomic fix, and I'm willing to contribute a patch to this, I'd just like to have some input on what sort of API/behaviour is best. :)

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.

1 participant