Repository navigation
Conversation
Remove use of STDERR to avoid test flakiness on CentOS. Fixes: nodejs#2477
|
But why was the test failing with |
|
@ChALkeR I don't know. It's a good question. If there is a (CentOS-specific?) problem around That said, it's not a bug with |
There was a problem hiding this comment.
I don't see how common.mustCall() can be used to replace the assertion here. Can you explain a bit more what you mean?
There was a problem hiding this comment.
Actually, common.mustCall makes sure that the exit handler is called for sure. Because the value is asserted only inside it. If the handler is never called, the test will still pass.
There was a problem hiding this comment.
Ah, because exit may not fire on the child process if there's an error. Good catch.
There was a problem hiding this comment.
common.mustCall uses process.exit internally. It is not safer than what is done here
There was a problem hiding this comment.
I was actually just going to just change child.on('exit', ...) to process.on('exit', ...) rather than use common.mustCall() for two reasons:
- I think it's clearer what is going on that way.
- This test does not load
common.jsto begin with because it doesn't need it. Loading the entire thing just for one use ofcommon.mustCall()seems like overkill whenprocess.on('exit', ...)will work just fine.
You (@targos) may very well be correct that child.on('exit', ...) and process.on('exit', ...) have the exact same behavior. But, at least according to the docs, the exit event on a ChildProcess might not fire. I can't find any similar warning in the docs on the exit event for process. So I'm inclined to go with process. If the exit event might not fire, that might be an issue to file against the docs. The text describing beforeExit seems to imply that exit can be depended on to fire for process.
There was a problem hiding this comment.
My bad, I misread the line as process.on('exit', ...).
commented
Aug 25, 2015
|
Pushed some changes, so new CI: https://jenkins-iojs.nodesource.com/job/node-test-pull-request/164/ |
commented
Aug 26, 2015
|
I am really not sure how it actually works. There is nothing printed explicitly. But still |
commented
Aug 26, 2015
|
As explained in the original commit, this test is just about argv[0]. My only concern is that the child might print the On the other hand, having the stderr of the child printed can be very useful for debug, it has just been now. The first commit is essentially a revert of 29463cb, it would be really nice to know why it was introduced but there is no PR-URL. And having child.stderr broken is a big issue - at the very least we must open an issue to find out what's wrong with the old test on CentOS. @Trott did you have a chance to test this on CentOS? I may be able to test this in the next few days. If this really fixes the test, I wouldn't object landing and investigating the problem in another issue. I'm +1 on the second commit, because if for some reason the child exit event callback does not run, the test may be false positive. |
commented
Aug 26, 2015
|
@joaocgreis I have not had a chance to run on CentOS other than the CI runs above. It would be great to see if 100 or 1000 consecutive runs of the old test produces a failure vs. results for the same with the new test. I suspect it won't be that simple and clear-cut though. |
commented
Aug 26, 2015
|
@joaocgreis I installed a CentOS 5 64-bit VM and managed to get the necessary versions of the right packages so that I can build node. Running the test as it currently exists on the Running it in a loop until it blows up, I've had it fail as early as run 41 and make it as far as run 511. Switching the version of the test in this PR, I can run it up to 10000 times and it does not blow up. So I think we have a winner here. For anyone with a CentOS 5 box wishing to replicate, here's the command I ran: |
commented
Aug 26, 2015
|
Just ran with/without these patches on our CI: centos5-32-1; without I managed to reproduce a few times below 100 runs while when applied (including coffee break) ran to 3257 without fail. |
commented
Aug 26, 2015
|
So the problem is with stderr? |
commented
Aug 26, 2015
|
I've opened an issue for the CentOS 5 issue that we're seeing in the current code. Anyone feel comfortable giving this PR an official |
commented
Aug 26, 2015
|
LGTM |
commented
Aug 26, 2015
|
Landed in 972a57c |
Remove use of STDERR to avoid test flakiness on CentOS.
Fixes: #2477
Additional benefit: This makes the test a fair bit faster.
Before:
real 0m0.909s
user 0m0.216s
sys 0m0.083s
After:
real 0m0.223s
user 0m0.193s
sys 0m0.035s