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: minimize test-http-get-pipeline-problem #5728

Closed
wants to merge 1 commit into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Mar 15, 2016

Pull Request check-list

Please make sure to review and check all of these items:

  • Does make -j8 test (UNIX) or vcbuild test nosign (Windows) pass with
    this change (including linting)?
  • Is the commit message formatted according to [CONTRIBUTING.md][0]?
  • If this change fixes a bug (or a performance problem), is a regression
    test (or a benchmark) included?
  • Is a documentation update included (if this change modifies
    existing APIs, or introduces new ones)?

Affected core subsystem(s)

test, http

Description of change

Reduce resoures required by test. Fixes test flakiness on Raspberry Pi in CI.

Clarify comment explaining source of test and what the test is looking
for.

Fixes: #5725

Reduce resoures required by test.

Clarify comment explaining source of test and what the test is looking
for.

Fixes: nodejs#5725
@Trott Trott added http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests. arm Issues and PRs related to the ARM platform. labels Mar 15, 2016
@Trott
Copy link
Member Author

Trott commented Mar 15, 2016

Stress test showing flakiness on current master: https://ci.nodejs.org/job/node-stress-single-test/560/nodes=pi2-raspbian-wheezy/console

@Trott
Copy link
Member Author

Trott commented Mar 15, 2016

For context:

Here's a gist from @mikeal who originally reported the bug: https://gist.githubusercontent.com/mikeal/864727/raw/561f3b665df0faff6d3ee9601ef31cc3caf0376f/gistfile1.js

That code fails on Node.js 0.6.0 and succeeds in 0.6.21.

If we change it to this, it still failsin Node.js 0.6.0 and succeeds in 0.6.21:

var http = require('http');
var fs = require('fs');
var parseUrl = require('url').parse;

http.globalAgent.maxSockets = 1;

var i = 10;
while(i > 0) {
  (function () {
    var x = i;
    var u = parseUrl("http://farm4.static.flickr.com/3557/3670453345_c38d482efb_m.jpg")

    var c = http.request(
      { host:u.hostname
      , port:u.port
      , method: 'GET'
      , path: u.pathname
      , headers: {host:u.hostname}
      }
      , function (res) {
        console.log(x)
        res.pipe(fs.createWriteStream(x + ".jpg"))
    })
    c.end();
    i--;
  })()
}

The key is that http.globalAgent.maxSockets needs to be less than i to trip the bug. So, that's why we are able to reduce the number of sockets in this test the way we do in this PR.

@Trott
Copy link
Member Author

Trott commented Mar 16, 2016

Stress test to hopefully show that this is not flaky. Hope I didn't typo in the parameters...

https://ci.nodejs.org/job/node-stress-single-test/563/nodes=pi2-raspbian-wheezy/console

@Trott
Copy link
Member Author

Trott commented Mar 18, 2016

Bump. /cc @nodejs/testing

@santigimeno
Copy link
Member

LGTM

@Trott Trott mentioned this pull request Mar 19, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Mar 20, 2016

LGTM

1 similar comment
@jasnell
Copy link
Member

jasnell commented Mar 21, 2016

LGTM

jasnell pushed a commit that referenced this pull request Mar 21, 2016
Reduce resoures required by test.

Clarify comment explaining source of test and what the test is looking
for.

Fixes: #5725
PR-URL: #5728
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell
Copy link
Member

jasnell commented Mar 21, 2016

Landed in ccb7b45

@jasnell jasnell closed this Mar 21, 2016
Fishrock123 pushed a commit that referenced this pull request Mar 22, 2016
Reduce resoures required by test.

Clarify comment explaining source of test and what the test is looking
for.

Fixes: #5725
PR-URL: #5728
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Mar 30, 2016
Reduce resoures required by test.

Clarify comment explaining source of test and what the test is looking
for.

Fixes: #5725
PR-URL: #5728
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Mar 30, 2016
Reduce resoures required by test.

Clarify comment explaining source of test and what the test is looking
for.

Fixes: #5725
PR-URL: #5728
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@Trott Trott deleted the fix-pipeline branch January 13, 2022 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arm Issues and PRs related to the ARM platform. http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate flaky test-http-get-pipeline-problem
5 participants