-
Notifications
You must be signed in to change notification settings - Fork 30k
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
test: ensure existence of _handle property #5916
Conversation
Thanks for the mention! Yes we're doing our jenkins builds inside of docker images. I'm running the tests using the (FWIW I've seen another case where node.js was being much more particular about IO streams than other languages.) |
@Trott is there an issue opened for this? or a way to reproduce it? I have run the test suite on docker from time to time but never saw that error |
@santigimeno It's not specific to Docker, although that might be a contributing factor. @bengl asked me about it today and I was able to reproduce the issue by using
|
Here's what the error looks like without this patch and using
|
Holy crap; I've been seeing this in gentoo in a sandbox for years but couldn't figure out what was going on. Thanks 👍 |
Alternate (perhaps better) solution might be to create a child process with an appropriate |
I'm pretty sure there is also an actual... API? issue here too. I suppose the question would be, should
node/lib/internal/process/stdio.js Lines 54 to 57 in 293fd04
|
OK, I've updated the test so that it doesn't skip if there's no If the current behavior is deemed a bug as @Fishrock123 seems to suggest, then we can put a version of this test in In the meantime, here's a version of the test that should always pass. |
I'm not sure if it is a bug so much as a possible API deficiency. I guess you could just write it off as an oddity but that seems pretty ... not-good to me, although I'm not really sure how to fix it either. |
I've made a PR for the known issue at #5935 |
The single CI failure appears to be known-flaky and unrelated. |
lgtm |
Giving it a go. Back soon with results. |
Good to see this being fixed. The suse build team for PPC was also seeing this failure and I was working with them to try and figure out why. |
Yep. Fixes the test for us. |
@jbergstroem do you happen to have also seen failures of test-cluster-master-error.js and test-cluster-master-kill.js? Given that you saw the test-stdtout-close-unref failure as well I thought I'd see how common these other two are before I dig into them. |
|
||
proc.on('exit', common.mustCall(function(exitCode) { | ||
assert.equal(exitCode, 0); | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest doing the following instead:
proc.stderr.pipe(process.stderr);
proc.on('exit', common.mustCall(function(exitCode) {
process.exitCode = exitCode;
}));
This way, you can see the child's error, and not need to generate a second error on the parent.
... What I'm going to be doing for TTY testing in #5834 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fishrock123 Ooh, yes, neat, will do. (I'm going to use process.exit(...)
instead of process.exitCode = ...
there if it's all the same to you.)
@drewfish sorry for the late response -- I swear I replied (this is the second time I've seen this happen; watching you github!). Anyway, haven't seen any issues with those tests from the gentoo sandbox. |
bc85d46
to
b808952
Compare
Whoops, pushed the wrong version, let's try again. Updated, PTAL. |
CI is being uncooperative. Let's CI again: https://ci.nodejs.org/job/node-test-pull-request/2105/ |
Well, it was more cooperative that time, but still one host hung while building or something. So let's do it again, because hey, I like my CI green: https://ci.nodejs.org/job/node-test-pull-request/2112/ |
@Fishrock123 Your LGTM still stands? |
|
||
proc.stderr.pipe(process.stderr); | ||
proc.on('exit', common.mustCall(function(exitCode) { | ||
process.exit(exitCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably make this just set the process.exitCode
, rather than exit()
.
exit()
is a bit ... expedited ... and can cause unwanted things. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fishrock123 I suppose so. I did that instead of setting process.exitCode
because setting the exit code but doing nothing else is kind of magical and also leaves open the possibility of someone adding a test to this file later on that does the same thing, thus overriding the exit code here. I'm probably overthinking it, though. Will switch to your recommendation.
lgtm otherwise |
`<`-ing a file into stdin actually results in a `fs.ReadStream`, rather than a `tty.ReadStream`, and as such does not inherit from net.Socket, unlike the other possible stdin options. Refs: nodejs#5916 PR-URL: nodejs#5935 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
`test-stdtout-close-unref.js` will fail if `process.stdin._handle` does not exist. On UNIX-like operating systems, you can see this failure this way: ./node test/parallel/test-stdout-close-unref.js < /dev/null This issue has been experienced by @bengl and @drewfish in a Docker container. I'm not sure why they are experiencing it in their environment, but since it is possible that the `_handle` property does not exist, let's use `child_process.spawn()` to make sure it exists.
Updated to use |
CI for good measure: https://ci.nodejs.org/job/node-test-pull-request/2116/ |
`test-stdtout-close-unref.js` will fail if `process.stdin._handle` does not exist. On UNIX-like operating systems, you can see this failure this way: ./node test/parallel/test-stdout-close-unref.js < /dev/null This issue has been experienced by @bengl and @drewfish in a Docker container. I'm not sure why they are experiencing it in their environment, but since it is possible that the `_handle` property does not exist, let's use `child_process.spawn()` to make sure it exists. PR-URL: nodejs#5916 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Landed in a20c700 |
`test-stdtout-close-unref.js` will fail if `process.stdin._handle` does not exist. On UNIX-like operating systems, you can see this failure this way: ./node test/parallel/test-stdout-close-unref.js < /dev/null This issue has been experienced by @bengl and @drewfish in a Docker container. I'm not sure why they are experiencing it in their environment, but since it is possible that the `_handle` property does not exist, let's use `child_process.spawn()` to make sure it exists. PR-URL: #5916 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
`test-stdtout-close-unref.js` will fail if `process.stdin._handle` does not exist. On UNIX-like operating systems, you can see this failure this way: ./node test/parallel/test-stdout-close-unref.js < /dev/null This issue has been experienced by @bengl and @drewfish in a Docker container. I'm not sure why they are experiencing it in their environment, but since it is possible that the `_handle` property does not exist, let's use `child_process.spawn()` to make sure it exists. PR-URL: #5916 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Pull Request check-list
Please make sure to review and check all of these items:
make -j8 test
(UNIX) orvcbuild test nosign
(Windows) pass withthis change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)?
Affected core subsystem(s)
test
Description of change
test-stdtout-close-unref.js
will fail ifprocess.stdin._handle
doesnot exist. On UNIX-like operating systems, you can see this failure this
way:
This issue has been experienced by @bengl and @drewfish in a Docker
container. I'm not sure why they are experiencing it in their
environment, but since it is possible that the
_handle
property doesnot exist, perhaps it should be checked.
@nodejs/testing