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

Process#exec: set close-on-exec to false for fd redirection #1805

Merged
merged 2 commits into from
Nov 8, 2019

Conversation

XrXr
Copy link
Contributor

@XrXr XrXr commented Nov 7, 2019

This is specifically for redirecting fd => fd.

Process#spawn behaves similarly, but that is more involved
to implement. MRI does it by setting close-on-exec after fork
and before exec while the current spawn implementation uses
posix_spawnp, which spawns in one go and offers less flexibility.

Shopify#1

XrXr and others added 2 commits November 7, 2019 16:29
This is specifically for redirecting `fd => fd`.

Process#spawn behaves similarly, but that is more involved
to implement. MRI does it by setting close-on-exec after fork
and before exec while the current spawn implementation uses
posix_spawnp, which spawns in one go and offers less flexibility.

Co-authored-by: Rafael Mendonça França <rafael@franca.dev>
@eregon
Copy link
Member

eregon commented Nov 8, 2019

Process#spawn behaves similarly, but that is more involved
to implement. MRI does it by setting close-on-exec after fork
and before exec while the current spawn implementation uses
posix_spawnp, which spawns in one go and offers less flexibility.

We could do something like that too, by always going through lib/truffle/spawn-helper, but I'm not sure what would be the downsides of that (potentially slower and some potential races until the helper executed the various close/fcntl.

We could also technically use fork+exec in native code in libtruffleposix.so, but that would be a large change.

@eregon eregon self-assigned this Nov 8, 2019
@eregon eregon added this to the 20.0.0 milestone Nov 8, 2019
@eregon eregon added the in-ci The PR is being tested in CI. Do not push new commits. label Nov 8, 2019
graalvmbot pushed a commit that referenced this pull request Nov 8, 2019
@graalvmbot graalvmbot merged commit 0bc1828 into oracle:master Nov 8, 2019
@chrisseaton chrisseaton deleted the close-on-exec branch December 3, 2019 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-ci The PR is being tested in CI. Do not push new commits. oca-signed shopify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants