Uh oh!
There was an error while loading. Please reload this page.
child_process: workaround fd passing issue on OS X - #7572
Conversation
Fishrock123
commented
Jul 7, 2016
There was a problem hiding this comment.
Would there be any harm in dropping the darwin checks here and in the tests?
There was a problem hiding this comment.
FWIW, I also think it's better not to special-case.
PR updated addressing @bnoordhuis and @cjihrig comments. Also, it includes modifications to make sure the |
There was a problem hiding this comment.
Should target._pendingHandle be a list or a Set? ISTM that it's not inconceivable for another handle to be sent while still waiting for the ACK for the first handle.
There was a problem hiding this comment.
I thought that was not possible because the messages/handles where stored in _handleQueue while there were pending ACK's: https://github.com/nodejs/node/blob/master/lib/internal/child_process.js#L566-575. Is this assumption correct?
There was a problem hiding this comment.
Oh, you're right. That's a bit of an implicit relationship, though. Maybe you can add a comment explaining the dependency on _handleQueue?
bnoordhuis
commented
Jul 9, 2016
LGTM with a comment. |
santigimeno
commented
Jul 10, 2016
Added requested comment. Not too sure of the wording though. |
bnoordhuis
commented
Jul 11, 2016
LGTM
It's fine. The next person knows they'll need to look at _handleQueue and that's the important thing. |
There was a problem hiding this comment.
Can you use strictEqual() here and throughout.
cjihrig
commented
Jul 11, 2016
LGTM with a couple comments. |
santigimeno
commented
Jul 12, 2016
Test updated. Rebased and squashed into a single commit. |
There was a problem hiding this comment.
I don't know if it's a good idea to spawn 80 processes. You might hit the ulimit on some systems and it will be very slow on the less powerful buildbots. It takes about 500 ms to start a process on the rpi1.
There was a problem hiding this comment.
I understand. That was one of the reasons why initially I was running this test only on OS X. I chose 80 because it was the magic number that caused the test to fail in my OS X almost 100% of the time. Maybe it's not a bad idea to run the test only in OS X as it seems an OS X only bug, and the basic functionality the test is checking is already covered by test-cluster-net-send.
There was a problem hiding this comment.
I suppose you could skip if '67'.includes(process.config.variables.arm_version), that would filter out the ARMv6 and ARMv7 buildbots (i.e., the rpis.)
santigimeno
commented
Jul 13, 2016
Updated so it skips the test in armv6 and armv7. |
santigimeno
commented
Jul 14, 2016
Unfortunately this change breaks |
santigimeno
commented
Jul 26, 2016
Strangely, the problem in |
santigimeno
commented
Jul 26, 2016
santigimeno
commented
Aug 17, 2016
@bnoordhuis@cjihrig Thoughts? |
bnoordhuis
commented
Aug 17, 2016
@santigimeno Are you asking for a re-review or is there an open question we should answer? |
santigimeno
commented
Aug 17, 2016
@bnoordhuis basically a review. I'm not sure it's a good idea not waiting for |
santigimeno
commented
Aug 18, 2016
santigimeno
commented
Aug 18, 2016
Incorporated @cjihrig suggestion and squashed into a single commit. Last CI was green. I'll land this tomorrow if there's no objection. |
santigimeno
commented
Aug 19, 2016
santigimeno
commented
Aug 19, 2016
One more CI run as there were some problems in the arm bots: |
There's an issue on some `OS X` versions when passing fd's between processes. When the handle associated to a specific file descriptor is closed by the sender process before it's received in the destination, the handle is indeed closed while it should remain opened. In order to fix this behaviour, don't close the handle until the `NODE_HANDLE_ACK` is received by the sender. Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but creating lots of workers, so the issue reproduces on `OS X` consistently. Fixes: nodejs#7512 PR-URL: nodejs#7572 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
santigimeno
commented
Aug 20, 2016
Last CI: https://ci.nodejs.org/job/node-test-pull-request/3765/ |
santigimeno
commented
Aug 20, 2016
Landed in db6253f. Thanks! |
There's an issue on some `OS X` versions when passing fd's between processes. When the handle associated to a specific file descriptor is closed by the sender process before it's received in the destination, the handle is indeed closed while it should remain opened. In order to fix this behaviour, don't close the handle until the `NODE_HANDLE_ACK` is received by the sender. Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but creating lots of workers, so the issue reproduces on `OS X` consistently. Fixes: #7512 PR-URL: #7572 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins
commented
Sep 30, 2016
@santigimeno / @bnoordhuis / @cjihrig should this be backported? |
santigimeno
commented
Oct 3, 2016
@thealphanerd I think so. Do you need a backport PR? |
MylesBorins
commented
Oct 3, 2016
yes please |
There's an issue on some `OS X` versions when passing fd's between processes. When the handle associated to a specific file descriptor is closed by the sender process before it's received in the destination, the handle is indeed closed while it should remain opened. In order to fix this behaviour, don't close the handle until the `NODE_HANDLE_ACK` is received by the sender. Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but creating lots of workers, so the issue reproduces on `OS X` consistently. Fixes: nodejs#7512 Ref: nodejs#7572 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
santigimeno
commented
Oct 3, 2016
@thealphanerd backport here: #8904 |
There's an issue on some `OS X` versions when passing fd's between processes. When the handle associated to a specific file descriptor is closed by the sender process before it's received in the destination, the handle is indeed closed while it should remain opened. In order to fix this behaviour, don't close the handle until the `NODE_HANDLE_ACK` is received by the sender. Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but creating lots of workers, so the issue reproduces on `OS X` consistently. Fixes: #7512 Ref: #8904 PR-URL: #7572 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
There's an issue on some `OS X` versions when passing fd's between processes. When the handle associated to a specific file descriptor is closed by the sender process before it's received in the destination, the handle is indeed closed while it should remain opened. In order to fix this behaviour, don't close the handle until the `NODE_HANDLE_ACK` is received by the sender. Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but creating lots of workers, so the issue reproduces on `OS X` consistently. Fixes: #7512 Ref: #8904 PR-URL: #7572 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
There's an issue on some `OS X` versions when passing fd's between processes. When the handle associated to a specific file descriptor is closed by the sender process before it's received in the destination, the handle is indeed closed while it should remain opened. In order to fix this behaviour, don't close the handle until the `NODE_HANDLE_ACK` is received by the sender. Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but creating lots of workers, so the issue reproduces on `OS X` consistently. Fixes: #7512 Ref: #8904 PR-URL: #7572 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
There's an issue on some `OS X` versions when passing fd's between processes. When the handle associated to a specific file descriptor is closed by the sender process before it's received in the destination, the handle is indeed closed while it should remain opened. In order to fix this behaviour, don't close the handle until the `NODE_HANDLE_ACK` is received by the sender. Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but creating lots of workers, so the issue reproduces on `OS X` consistently. Fixes: #7512 Ref: #8904 PR-URL: #7572 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
child_process
Description of change
There's an issue on some
OS Xversions when passing fd's between processes.When the handle associated to a specific file descriptor is closed by the sender
process before it's received in the destination, the handle is indeed closed
while it should remain opened. As a workaround for
OS X, don't close thehandle until the
NODE_HANDLE_ACKis received by the sender.Added
test-child-process-pass-fdthat is basicallytest-cluster-net-sendbutcreating lots of workers, so the issue reproduces on
OS Xconsistently.Fixes: #7512
/cc @bnoordhuis