GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix flaky test-child-process-emfile by Trott · Pull Request #3430 · nodejs/node

Conversation

@Trott

@Trott Trott commented Oct 19, 2015

Copy link
Copy Markdown
Member

Require the test setup to obtain an EMFILE error and not ENFILE as
ENFILE means there is a race condition with other processes that may
close files before spawn() is called by the test.

This test as is had failed 6 out of 26 times that are in the Jenkins history for freebsd101-32 at https://ci.nodejs.org/job/node-test-commit-freebsd/. With the fix, it has run successfully 12 out of 12 times. (UPDATE: 14 out of 14 now.)

Fixes: #2666

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Trott Trott added the test Issues and PRs related to Node.js core tests and test infrastructure. label Oct 19, 2015
@Trott Trott mentioned this pull request Oct 19, 2015
Investigate flaky test test-child-process-emfile #2666
Closed
@Trott

Trott commented Oct 19, 2015

Copy link
Copy Markdown
Member Author

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

EDIT: Pushed a commit to remove some cruft that wasn't needed. New CI: https://ci.nodejs.org/job/node-test-pull-request/532/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mscdex mscdex added the child_process Issues and PRs related to the child_process subsystem. label Oct 19, 2015
bnoordhuis
bnoordhuis reviewed Oct 19, 2015
View reviewed changes
Comment thread test/sequential/test-child-process-emfile.js Outdated

@bnoordhuis bnoordhuis Oct 19, 2015

Copy link
Copy Markdown
Member

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.

You should probably exec ulimit -Hn here because node sets RLIMIT_NOFILE to the hard limit at startup. I'm not sure how portable the -H flag is though.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Trott Trott Oct 19, 2015

Copy link
Copy Markdown
Member Author

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.

Use of -H requires super-user privileges, at least on OS X. This means make test will fail for people unless they run it as root.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bnoordhuis bnoordhuis Oct 19, 2015

Copy link
Copy Markdown
Member

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.

Even when just querying the hard limit? That seems to work on my 10.8 macbook, FWIW.

That did remind me of something: ulimit can print "unlimited". That gets coerced to NaN and will fail the ulimit > 64 check.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jbergstroem jbergstroem Oct 19, 2015

Copy link
Copy Markdown
Member

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.

Re portability: ulimit -Hn works for me without root privileges on our smartos and freebsd boxes (also works locally on osx 10.11).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Trott Trott Oct 19, 2015

Copy link
Copy Markdown
Member Author

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.

ulimit -Hn works fine on OS X without super-user privileges. It's setting (e.g., ulimit -Hn 64) that requires super-user.

Good catch on the unlimited string. I'll fix that...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Trott Trott Oct 19, 2015

Copy link
Copy Markdown
Member Author

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.

@jbergstroem I guess I can go and run it on CI and see what happens...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jbergstroem jbergstroem Oct 19, 2015

Copy link
Copy Markdown
Member

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.

@Trott breaks on setting smartos though: -bash: ulimit: open files: cannot modify limit: Invalid argument

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bnoordhuis bnoordhuis Oct 20, 2015

Copy link
Copy Markdown
Member

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'd use ulimit -Hn for querying, ulimit -n num is fine for setting it because it sets both the hard and soft limit. Just querying for ulimit -n would be wrong in the (admittedly unlikely) case that the soft limit is <= 64 but the hard limit is > 64.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Trott Trott Oct 20, 2015

Copy link
Copy Markdown
Member Author

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.

@jbergstroem ulimit -Hn <integer> works without super-user privs for me if and only if I first set the soft limit as low or lower than what I'm trying to set the hard limit to. (In retrospect: Duh!) And sudo doesn't fix it. I thought it did because I was testing in different shell instances and must have had the soft limit already set appropriately in one of them.

TL;DR: You were right to be surprised (skeptical?) of my results.

The @bnoordhuis plan of setting with -n and querying with -Hn makes the most sense to me.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Trott Trott Oct 20, 2015

Copy link
Copy Markdown
Member Author

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.

P.S. The error message you got on smartos is what I was getting on OS X so maybe check that you weren't trying to set the hard limit lower than the soft limit? (Although it doesn't really matter since we can and, in this case, should set the soft limit as well so we can just use -n.)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bnoordhuis

bnoordhuis commented Oct 19, 2015

Copy link
Copy Markdown
Member

LGTM with a comment.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MylesBorins

MylesBorins commented Oct 19, 2015

Copy link
Copy Markdown
Contributor

@jasnell LTS?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell added the lts-watch-v4.x label Oct 19, 2015
@Trott
Trott force-pushed the flaky-test-child-process-emfile branch from 3ce3dba to 114d317 Compare October 20, 2015 04:29
@Trott

Trott commented Oct 20, 2015

Copy link
Copy Markdown
Member Author

Added handling for unlimited being coerced to NaN.

New CI: https://ci.nodejs.org/job/node-test-pull-request/537/ Er...nope. Looks like something's up with Jenkins? Will try again later....

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbergstroem

jbergstroem commented Oct 20, 2015

Copy link
Copy Markdown
Member

..that'd be my bad. Was doing some changes to the node-test-commit job around the same time you posted it. https://ci.nodejs.org/job/node-test-commit/888/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnoordhuis
bnoordhuis reviewed Oct 20, 2015
View reviewed changes
Comment thread test/sequential/test-child-process-emfile.js Outdated

@bnoordhuis bnoordhuis Oct 20, 2015

Copy link
Copy Markdown
Member

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.

Consider putting quotes around the paths, in case there are spaces in them.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Trott Trott Oct 20, 2015

Copy link
Copy Markdown
Member Author

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.

Ah, yeah, good one. Thanks. Done. There's probably still edge cases (quotation marks in the path?) but this should deal with all the most likely ones. Thanks again.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Trott added 4 commits October 20, 2015 09:26
@Trott
test: fix flaky test-child-process-emfile
421b571
Require the test setup to obtain an EMFILE error and not ENFILE as
ENFILE means there is a race condition with other processes that may
close files before `spawn()` is called by the test.

Fixes: nodejs#2666
@Trott
fixup
30edd30
@Trott
fixup: handle unlimited being coerced to NaN
5556196
@Trott
fixup: set with -n, check with -Hn
1a6d2e6
@Trott
Trott force-pushed the flaky-test-child-process-emfile branch from 114d317 to 1a6d2e6 Compare October 20, 2015 16:44
@Trott
fixup: add quotes around paths
5f5bb36
@Trott

Trott commented Oct 20, 2015

Copy link
Copy Markdown
Member Author

CI with latest @bnoordhuis suggestions: https://ci.nodejs.org/job/node-test-commit/892/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Oct 20, 2015

Copy link
Copy Markdown
Member

LGTM

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Oct 20, 2015

Copy link
Copy Markdown
Member

LGTM. @Trott can I ask you to squash the commits down please?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Oct 20, 2015

Copy link
Copy Markdown
Member Author

@jasnell Yup. I always squash 'em before I land.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott mentioned this pull request Oct 20, 2015
test: wrap assert.fail when passed to callback #3453
Closed
Trott added a commit to Trott/io.js that referenced this pull request Oct 20, 2015
@Trott
test: fix flaky test-child-process-emfile
d89bc7b
Require the test setup to obtain an EMFILE error and not ENFILE as
ENFILE means there is a race condition with other processes that may
close files before `spawn()` is called by the test.

Fixes: nodejs#2666
PR-URL: nodejs#3430
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@Trott

Trott commented Oct 20, 2015

Copy link
Copy Markdown
Member Author

Landed in d89bc7b.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott closed this Oct 20, 2015
Trott added a commit that referenced this pull request Oct 21, 2015
@Trott @rvagg
test: fix flaky test-child-process-emfile
04fb14c
Require the test setup to obtain an EMFILE error and not ENFILE as
ENFILE means there is a race condition with other processes that may
close files before `spawn()` is called by the test.

Fixes: #2666
PR-URL: #3430
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@rvagg rvagg mentioned this pull request Oct 21, 2015
Release proposal: v5.0.0 #3466
Merged
Trott added a commit that referenced this pull request Oct 26, 2015
@Trott @jasnell
test: fix flaky test-child-process-emfile
0b32414
Require the test setup to obtain an EMFILE error and not ENFILE as
ENFILE means there is a race condition with other processes that may
close files before `spawn()` is called by the test.

Fixes: #2666
PR-URL: #3430
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell

jasnell commented Oct 26, 2015

Copy link
Copy Markdown
Member

Landed in v4.x-staging in 0b32414

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell added land-on-v4.x and removed lts-watch-v4.x labels Oct 26, 2015
@rvagg rvagg mentioned this pull request Oct 28, 2015
Preparing v4.2.2 LTS Maintenance nodejs/Release#50
Closed
Trott added a commit that referenced this pull request Oct 29, 2015
@Trott @jasnell
test: fix flaky test-child-process-emfile
a5d968b
Require the test setup to obtain an EMFILE error and not ENFILE as
ENFILE means there is a race condition with other processes that may
close files before `spawn()` is called by the test.

Fixes: #2666
PR-URL: #3430
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell jasnell removed the land-on-v4.x label Nov 3, 2015
@Trott
Trott deleted the flaky-test-child-process-emfile branch January 13, 2022 22:29
@leonardoadame leonardoadame mentioned this pull request Nov 28, 2023
[Snyk] Fix for 6 vulnerabilities leonardoadame/node#185
Open
@aliscco aliscco mentioned this pull request Nov 28, 2023
[Snyk] Fix for 5 vulnerabilities aliscco/alisco-node#694
Open
@leonardoadame leonardoadame mentioned this pull request Nov 29, 2023
[Snyk] Fix for 6 vulnerabilities leonardoadame/node#210
Open
This was referenced Nov 29, 2023
[Snyk] Fix for 4 vulnerabilities aliscco/alisco-node#714
Open
[Snyk] Fix for 5 vulnerabilities aliscco/alisco-node#732
Open
@leonardoadame leonardoadame mentioned this pull request Nov 29, 2023
[Snyk] Fix for 5 vulnerabilities leonardoadame/node#263
Open
This was referenced Nov 29, 2023
[Snyk] Fix for 14 vulnerabilities aliscco/alisco-node#776
Open
[Snyk] Fix for 6 vulnerabilities aliscco/alisco-node#1023
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

child_process Issues and PRs related to the child_process subsystem. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Investigate flaky test test-child-process-emfile

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@Trott @bnoordhuis @MylesBorins @jbergstroem @jasnell @mscdex
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.