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

RSR sockets should set FD_CLOEXEC #165

Open
martinmcclure opened this issue Nov 6, 2024 · 2 comments
Open

RSR sockets should set FD_CLOEXEC #165

martinmcclure opened this issue Nov 6, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@martinmcclure
Copy link
Member

RSR sockets should set FD_CLOEXEC on platforms where this is possible.

Otherwise, an open socket will be inherited by any local child processes.
A subsequent local close of the RSR connection will not be realized by the remote end, since the socket remains open locally until the child process closes it (or exits).

@martinmcclure martinmcclure added the bug Something isn't working label Nov 6, 2024
@martinmcclure
Copy link
Member Author

Pharo does not directly support close-on-exec behavior.
There is a Pharo issue for this: pharo-project/pharo#12576

Workaround for Linux:
On the Pharo Discord, Pablo reports that you can get a file descriptor from a socket handle like this:
(aSocket socketHandle pointerAt: 9) signedLongAt: 1
Given the fd, one should be able to call fcntl.
I don't know whether this would work on MacOS.

For Windows, Feenk has found that calling SetHandleInformation can be used to set close-on-exec on a socket.
See their issue feenkcom/gtoolkit#4163

@Rinzwind
Copy link

Regarding the question in the previous comment of whether that would work on macOS: see the snippet I gave in Zinc issue #101 for setting FD_CLOEXEC on the Zinc server’s socket which, as indicated in the comment in the snippet, I tested on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants