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

failed test: parallel/test-child-process-stdout-flush-exit #944

Closed
jbergstroem opened this issue Feb 25, 2015 · 10 comments
Closed

failed test: parallel/test-child-process-stdout-flush-exit #944

jbergstroem opened this issue Feb 25, 2015 · 10 comments
Labels
test Issues and PRs related to the tests.

Comments

@jbergstroem
Copy link
Member

I'm seeing a rare test fail (been able to reproduce twice over ~100 test runs) on a mac os x 10.10 machine. Tested with io.js 8a1e22a:

Path: parallel/test-child-process-stdout-flush-exit
assert.js:87
  throw new assert.AssertionError({
        ^
AssertionError: false == true
    at ChildProcess.<anonymous> (/Users/jbergstroem/io.js/test/parallel/test-child-process-stdout-flush-exit.js:43:5)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:169:7)
    at maybeClose (child_process.js:984:16)
    at Socket.<anonymous> (child_process.js:1153:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:166:7)
    at Pipe.close (net.js:464:12)
Command: out/Release/iojs /Users/jbergstroem/io.js/test/parallel/test-child-process-stdout-flush-exit.js
@brendanashworth brendanashworth added the test Issues and PRs related to the tests. label Feb 25, 2015
@jbergstroem
Copy link
Member Author

Can't reproduce this any longer. Closing for now.

@Fishrock123
Copy link
Contributor

There's something flaky going on here:

Jeremiahs-MacBook-Pro:io.js Jeremiah$ make test
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C out BUILDTYPE=Release V=1
make[1]: Nothing to be done for `all'.
ln -fs out/Release/iojs iojs
/usr/bin/python tools/test.py --mode=release message parallel sequential -J
=== release test-child-process-stdout-flush-exit ===                      
Path: parallel/test-child-process-stdout-flush-exit
assert.js:87
  throw new assert.AssertionError({
        ^
AssertionError: false == true
    at ChildProcess.<anonymous> (/Users/Jeremiah/Documents/io.js/test/parallel/test-child-process-stdout-flush-exit.js:43:5)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:169:7)
    at maybeClose (child_process.js:984:16)
    at Socket.<anonymous> (child_process.js:1153:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:166:7)
    at Pipe.close (net.js:464:12)
Command: out/Release/iojs /Users/Jeremiah/Documents/io.js/test/parallel/test-child-process-stdout-flush-exit.js
[00:57|% 100|+ 818|-   1]: Done                                                
make: *** [test] Error 1

OS X 10.10.2, io.js at 78581c8, happened only once so far.

@Fishrock123 Fishrock123 reopened this Mar 4, 2015
@piscisaureus
Copy link
Contributor

@bnoordhuis Could this have something to do with stdout being asynchronous?

@tellnes
Copy link
Contributor

tellnes commented Mar 4, 2015

I've also seen this on os x 10.9.5.

@bnoordhuis
Copy link
Member

@piscisaureus That seems to be the issue, yes. The test failure is 100% reproducible when you add a delay in the parent process:

diff --git a/test/parallel/test-child-process-stdout-flush-exit.js b/test/parallel/test-child-process-stdout-flush-exit.js
index eba8927..5fbb1e9 100644
--- a/test/parallel/test-child-process-stdout-flush-exit.js
+++ b/test/parallel/test-child-process-stdout-flush-exit.js
@@ -17,6 +17,8 @@ if (process.argv[2] === 'child') {
   // spawn self as child
   var child = spawn(process.argv[0], [process.argv[1], 'child']);

+  for (var t = Date.now(); t + 1e3 > Date.now(););
+
   var gotHello = false;
   var gotBye = false;

It doesn't seem to be an issue of libuv buffering data and not getting a chance to flush it because even when all writes hit the kernel, the test still fails. I speculate that data ends up in the kernel pipe buffer and is subsequently lost when the child process exits.

@Fishrock123
Copy link
Contributor

Also cropped up on the latest (otherwise green) windows build: https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/359/nodes=iojs-win2012r2/console

@rvagg
Copy link
Member

rvagg commented Mar 22, 2015

been a semi-regular offender on the Windows CI machines of late actually

@abrady0
Copy link

abrady0 commented Apr 23, 2015

I'm seeing this 100% of the time when a child process outputs a large amount of text (>8k) and calls subprocess.exit().

here is a gist that repros: https://gist.github.com/abrady0/f69de07b79d1b50b0ca0

if you comment line 43 out it will succeed.

@Fishrock123
Copy link
Contributor

Should be fixed in 311c3e4

bnoordhuis pushed a commit that referenced this issue Jun 2, 2015
Make sure all the stdout data is available before
performing the assertions.

Fixes: #944
PR-URL: #1868
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@bnoordhuis
Copy link
Member

Make that b926718.

andrewdeandrade pushed a commit to andrewdeandrade/node that referenced this issue Jun 3, 2015
Make sure all the stdout data is available before
performing the assertions.

Fixes: nodejs/node#944
PR-URL: nodejs/node#1868
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

No branches or pull requests

8 participants