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

test: fix flaky test-preload #6728

Closed
wants to merge 1 commit into from
Closed

test: fix flaky test-preload #6728

wants to merge 1 commit into from

Conversation

Trott
Copy link
Member

@Trott Trott commented May 13, 2016

Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

Use close event rather than exit event to make sure all output has
been received before checking assertions.

Fixes: #6722

/cc @Fishrock123 @mhdawson
h/t @santigimeno

Use `close` event rather than `exit` event to make sure all output has
been received before checking assertions.

Fixes: nodejs#6722
@Trott Trott added the test Issues and PRs related to the tests. label May 13, 2016
@Trott
Copy link
Member Author

Trott commented May 13, 2016

Stress test showing the test flaky on current master on CentOS 7 (64-bit):
https://ci.nodejs.org/job/node-stress-single-test/720/nodes=centos7-64/console

Stress test showing the test reliable on this PR's branch on CentOS 7 (64-bit):
https://ci.nodejs.org/job/node-stress-single-test/719/nodes=centos7-64/console

CI: https://ci.nodejs.org/job/node-test-pull-request/2627/

@santigimeno
Copy link
Member

I can reproduce the problem locally on OS X. With this fix, the problem disappears.

LGTM

@evanlucas
Copy link
Contributor

LGTM. I just noticed this locally and was trying to figure out what was up. :]

@cjihrig
Copy link
Contributor

cjihrig commented May 13, 2016

LGTM

@Fishrock123 Fishrock123 mentioned this pull request May 13, 2016
2 tasks
@Fishrock123
Copy link
Contributor

LGTM, should we add comments for this, or is this expected?

@Trott
Copy link
Member Author

Trott commented May 13, 2016

@Fishrock123 asked:

...should we add comments for this, or is this expected?

Not sure...

According to the docs for exit:

Note that when the 'exit' event is triggered, child process stdio streams might still be open.

So, expected behavior, hooray! Except...

On the other hand, the docs for close say:

The 'close' event is emitted when the stdio streams of a child process have been closed. This is distinct from the 'exit' event, since multiple processes might share the same stdio streams.

Multiple processes sharing stdio...we don't have that here, right? Hmmm...

It might also be a manifestation of a known issue around exit and buffering stdio but again, I'm not sure.

@Trott
Copy link
Member Author

Trott commented May 13, 2016

Anyone else think it's a good idea to land this soon rather than giving it the 72 hours that it would require if it were non-trivial? I'm thinking about:

  • the trivial nature of this change
  • the ease with which it could be reverted or amended if necessary (most likely with a comment or two)
  • the importance (to me, at least) of having reliable CI results that people don't ignore; these frequent failures are a menace
  • the exactly-as-expected stress test and CI results for the PR
  • four LGTMs

@Fishrock123
Copy link
Contributor

Fishrock123 commented May 13, 2016

It fixes the CI and the related issue have been open for at least a day? Trivial enough to land imo. (Also it's not the weekend yet, 48 hours.)

@addaleax
Copy link
Member

LGTM and go ahead, please :)

@santigimeno
Copy link
Member

It may also be worth noting that the behavior might change with the upcoming libuv release, which, IIUIC, would guarantee that the exit event would be emitted always after the close event. See @bnoordhuis comment here: #6575 (comment)

Trott added a commit to Trott/io.js that referenced this pull request May 13, 2016
Use `close` event rather than `exit` event to make sure all output has
been received before checking assertions.

PR-URL: nodejs#6728
Fixes: nodejs#6722
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@Trott
Copy link
Member Author

Trott commented May 13, 2016

Landed in b5a75ba.

@Trott Trott closed this May 13, 2016
evanlucas pushed a commit that referenced this pull request May 17, 2016
Use `close` event rather than `exit` event to make sure all output has
been received before checking assertions.

PR-URL: #6728
Fixes: #6722
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@Trott Trott deleted the mandruff branch January 13, 2022 22:43
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

Successfully merging this pull request may close these issues.

Investigate flaky test-preload.js
7 participants