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 net-socket-timeout-unref flakiness #4772

Closed

Conversation

santigimeno
Copy link
Member

From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.

The error I'm getting is

=== release test-net-socket-timeout-unref ===                                  
Path: parallel/test-net-socket-timeout-unref
[]
[]
[]
[]
assert.js:89
  throw new assert.AssertionError({
  ^
AssertionError: Socket timeout should not hold loop open
    at process.<anonymous> (/Users/sgimeno/node/node/test/parallel/test-net-socket-timeout-unref.js:26:10)
    at emitOne (events.js:96:20)
    at process.emit (events.js:183:7)

I don't know if it's a legit issue or just a problem in my OS X machine as it seems strange that some connection takes that long, but I have seen this error appear relatively frequently when running the test suite and I can reproduce it more easily by running multiple copies of this test in parallel.

@mscdex mscdex added net Issues and PRs related to the net subsystem. test Issues and PRs related to the tests. macos Issues and PRs related to the macOS platform / OSX. labels Jan 19, 2016
@jasnell
Copy link
Member

jasnell commented Jan 22, 2016

/cc @Trott @nodejs/testing

@r-52
Copy link
Contributor

r-52 commented Jan 31, 2016

@santigimeno saw it also on my OS X machine, but it's really really rare.

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

@Trott
Copy link
Member

Trott commented Feb 3, 2016

Just had this test fail on me in CI for the first time I can remember:

https://ci.nodejs.org/job/node-test-binary-arm/926/RUN_SUBSET=0,nodes=pi1-raspbian-wheezy/console

@Trott
Copy link
Member

Trott commented Feb 3, 2016

LGTM and CI is green. Any thoughts or concerns @jasnell @romankl @nodejs/testing ? I'd like at least one more LGTM besides my own.

});
socket.unref();

sockets.push([ socket, T ]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the whitespace around the braces.

Trott added a commit to Trott/io.js that referenced this pull request Feb 3, 2016
Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: nodejs#4772 (comment)
@santigimeno santigimeno force-pushed the net-socket-timeout-unref branch from f13d1a6 to bf52603 Compare February 3, 2016 22:10
@santigimeno
Copy link
Member Author

PR update. Thanks for the review.

timedout = true;
socket.destroy();
socket.on('connect', function() {
if (++connections === 6) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the hard coded 6. Maybe use the array length.

@cjihrig
Copy link
Contributor

cjihrig commented Feb 3, 2016

One comment. LGTM if the CI is happy.

From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.
@santigimeno santigimeno force-pushed the net-socket-timeout-unref branch from bf52603 to 3e67429 Compare February 3, 2016 23:46
@santigimeno
Copy link
Member Author

Sorry, I forgot about that. Done

@Trott
Copy link
Member

Trott commented Feb 4, 2016

@jasnell
Copy link
Member

jasnell commented Feb 4, 2016

LGTM

jasnell pushed a commit that referenced this pull request Feb 4, 2016
From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.

PR-URL: #4772
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell
Copy link
Member

jasnell commented Feb 4, 2016

Landed in 538813c

@jasnell jasnell closed this Feb 4, 2016
jasnell pushed a commit that referenced this pull request Feb 4, 2016
Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: #4772 (comment)
PR-URL: #5063
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 8, 2016
From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.

PR-URL: #4772
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 8, 2016
Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: #4772 (comment)
PR-URL: #5063
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 9, 2016
Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: #4772 (comment)
PR-URL: #5063
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 17, 2016
From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.

PR-URL: #4772
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 18, 2016
Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: #4772 (comment)
PR-URL: #5063
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 18, 2016
From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.

PR-URL: #4772
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 18, 2016
Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: #4772 (comment)
PR-URL: #5063
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 18, 2016
MylesBorins pushed a commit that referenced this pull request Mar 2, 2016
From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.

PR-URL: #4772
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Mar 2, 2016
Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: #4772 (comment)
PR-URL: #5063
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.

PR-URL: nodejs#4772
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: nodejs#4772 (comment)
PR-URL: nodejs#5063
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macos Issues and PRs related to the macOS platform / OSX. net Issues and PRs related to the net subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants