Skip to content

Conversation

@tarruda
Copy link
Contributor

@tarruda tarruda commented Sep 2, 2019

The 'overlapped' value sets the UV_OVERLAPPED_PIPE libuv flag in the child process stdio.

Fixes: #29238

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests added
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. child_process Issues and PRs related to the child_process subsystem. labels Sep 2, 2019
@tarruda tarruda force-pushed the expose-stdio-overlapped-pipe branch from 9bbddd4 to 57c0f01 Compare September 2, 2019 19:00
@tarruda tarruda changed the title child_process: Add 'pipe+overlapped' stdio flag child_process: add 'pipe+overlapped' stdio flag Sep 2, 2019
@mscdex
Copy link
Contributor

mscdex commented Sep 2, 2019

Why not just always set UV_OVERLAPPED_PIPE for 'pipe' instead? Are there any drawbacks/incompatibilities with that?

@tarruda
Copy link
Contributor Author

tarruda commented Sep 2, 2019

Why not just always set UV_OVERLAPPED_PIPE for 'pipe' instead? Are there any drawbacks/incompatibilities with that?

Yes, it can possibly break existing programs that run child process that are not prepared for overlapped I/O: libuv/libuv#95 (comment)

@tarruda tarruda force-pushed the expose-stdio-overlapped-pipe branch from 57c0f01 to d4eb7bc Compare September 2, 2019 19:55
@mscdex
Copy link
Contributor

mscdex commented Sep 2, 2019

Ok, perhaps we can just shorten the name to 'overlapped' instead?

@tarruda
Copy link
Contributor Author

tarruda commented Sep 3, 2019

Ok, perhaps we can just shorten the name to 'overlapped' instead?

Added a fixup. If this is acceptable I will squash and edit the commit message.

@tarruda tarruda changed the title child_process: add 'pipe+overlapped' stdio flag child_process: add 'overlapped' stdio flag Sep 3, 2019
@tarruda tarruda force-pushed the expose-stdio-overlapped-pipe branch from 0a5b520 to 196c6ea Compare September 3, 2019 12:59
@mscdex
Copy link
Contributor

mscdex commented Sep 3, 2019

Can you also add a test for this?

@tarruda
Copy link
Contributor Author

tarruda commented Sep 3, 2019

Can you also add a test for this?

Do you have any suggestions on how I should proceed to testing this?

The new option simply activates the UV_OVERLAPPED_PIPE libuv flag, is there any existing test infrastructure to verify that the correct flags were passed by the new option? I couldn't find any reference to UV_CREATE_PIPE in the tests, so I imagine the answer is "no".

I suppose I could just add a functional test that verifies overlapped I/O on the child process, but that would probably be duplicating one of the libuv tests.

Also, the code path should be close to the one followed by the'pipe' value. Would it be enough to copy one of the 'pipe' tests but pass 'overlapped' instead?

@mscdex
Copy link
Contributor

mscdex commented Sep 5, 2019

At the very least there should be a test that specifying 'overlapped' (via stdio: 'overlapped' or manually expanded out to stdio: ['overlapped', 'overlapped', 'overlapped']) does not throw an exception (since the code currently throws on unsupported modes).

Fishrock123
Fishrock123 previously approved these changes Sep 5, 2019
@Fishrock123 Fishrock123 dismissed their stale review September 5, 2019 18:00

Pending tests as mscdex mentioned.

@tarruda
Copy link
Contributor Author

tarruda commented Sep 5, 2019

At the very least there should be a test that specifying 'overlapped' (via stdio: 'overlapped' or manually expanded out to stdio: ['overlapped', 'overlapped', 'overlapped']) does not throw an exception (since the code currently throws on unsupported modes).

👍

I also want to add a test that runs a C++ windows program that will not work if the stdio handles are not overlapped pipes.

@Trott Trott added the wip Issues and PRs that are still a work in progress. label Sep 6, 2019
@tarruda tarruda force-pushed the expose-stdio-overlapped-pipe branch 5 times, most recently from 31ac422 to e06685e Compare September 6, 2019 21:46
@tarruda
Copy link
Contributor Author

tarruda commented Sep 6, 2019

I've added "overlapped-checker", a program which is used to verify the FILE_FLAG_OVERLAPPED status from the child. The new test uses this program to verify that the flag is correctly passed.

@tarruda tarruda force-pushed the expose-stdio-overlapped-pipe branch 3 times, most recently from 9ad1420 to a28f5a3 Compare September 6, 2019 23:17
@tarruda
Copy link
Contributor Author

tarruda commented Sep 6, 2019

PR ready for final review.

@tarruda tarruda requested a review from Fishrock123 September 6, 2019 23:52
@Trott Trott removed the wip Issues and PRs that are still a work in progress. label Sep 7, 2019
@aduh95 aduh95 closed this Jan 3, 2021
@tarruda
Copy link
Contributor Author

tarruda commented Jan 4, 2021

Thanks @aduh95 @joaocgreis @bnoordhuis for the help with this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. child_process Issues and PRs related to the child_process subsystem. review wanted PRs that need reviews. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creation of full duplex pipe via spawn causes deadlock on Windows

10 participants