Skip to content

test: fix flaky test-net-can-reset-timeout - #14257

Closed
Trott wants to merge 1 commit into
nodejs:masterfrom
Trott:fix-can-reset-timer
Closed

test: fix flaky test-net-can-reset-timeout#14257
Trott wants to merge 1 commit into
nodejs:masterfrom
Trott:fix-can-reset-timer

Conversation

@Trott

Copy link
Copy Markdown
Member

timeout can fire more than once, so remove the listener after the first time. The test still checks for issue that the test was originally written for (nodejs/node-v0.x-archive#481).

Fixes: #14241

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test net

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Jul 15, 2017
@Trott

Copy link
Copy Markdown
MemberAuthor

I would like to expedite this so that it doesn't trip us up during Code + Learn later.

/cc @nodejs/testing @bengl@joyeecheung@addaleax@refack

@mscdexmscdex added the net Issues and PRs related to the net subsystem. label Jul 15, 2017
@Trott

Copy link
Copy Markdown
MemberAuthor

With this change:

$ tools/test.py -j 92 --repeat 920 test/parallel/test-net-can-reset-timeout.js[02:14|% 100|+ 920|- 0]: Done 
$ 

To compare with before the change, see #14241 (comment).

@Trott

Copy link
Copy Markdown
MemberAuthor

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just using .once instead seems a bit simpler?

@refackrefack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 Nit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's wrong with once?

@refack

Copy link
Copy Markdown
Contributor

@Trott I took the liberty of adding a comment with context, feel free to remove it, or whatever.
I approved even with the explicit removeListener... But once seems like the simpler choice...

@Trott
Trottforce-pushed the fix-can-reset-timer branch from f9936ed to 8ea652dCompareJuly 16, 2017 00:26
@Trott

Copy link
Copy Markdown
MemberAuthor

Switched to .once(). Much simpler. 😆

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

@refack

refack commented Jul 16, 2017

Copy link
Copy Markdown
Contributor

Switched to .once(). Much simpler. 😆

You didn't like my comment or just didn't see it?

// When you write to a socket, it causes 'Timer.active' to be called on it.// If `active` notices that it was previously removed (perhaps it timed out or// something) it just does an 'inline append' which re-links the timer.// Ref: https://github.com/nodejs/node-v0.x-archive/issues/481

@Trott

Copy link
Copy Markdown
MemberAuthor

You didn't like my comment or just didn't see it?

I wasn't quite sure I understood it out of context. I thought reading the test was actually more clear than the comment, but that may say more about me than the comment? Thinking about it more, though, I think having a link to the issue is a good idea so I'll at least add that back in...

@Trott
Trottforce-pushed the fix-can-reset-timer branch from 8ea652d to f9d1804CompareJuly 16, 2017 00:59
Trott added a commit to Trott/io.js that referenced this pull request Jul 16, 2017
Use `.once()` rather than `.on()` for timeout listener.
Add comment with URL for issue explaining the purpose of the test. (h/t
refack)
PR-URL: nodejs#14257Fixes: nodejs#14241
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
@Trott

Copy link
Copy Markdown
MemberAuthor

Landed in 5d3609d

@TrottTrott closed this Jul 16, 2017
@addaleaxaddaleax mentioned this pull request Jul 18, 2017
addaleax pushed a commit that referenced this pull request Jul 18, 2017
Use `.once()` rather than `.on()` for timeout listener.
Add comment with URL for issue explaining the purpose of the test. (h/t
refack)
PR-URL: #14257Fixes: #14241
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Fishrock123 pushed a commit that referenced this pull request Jul 19, 2017
Use `.once()` rather than `.on()` for timeout listener.
Add comment with URL for issue explaining the purpose of the test. (h/t
refack)
PR-URL: #14257Fixes: #14241
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
MylesBorins pushed a commit that referenced this pull request Aug 16, 2017
Use `.once()` rather than `.on()` for timeout listener.
Add comment with URL for issue explaining the purpose of the test. (h/t
refack)
PR-URL: #14257Fixes: #14241
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
@MylesBorinsMylesBorins mentioned this pull request Aug 16, 2017
MylesBorins pushed a commit that referenced this pull request Aug 16, 2017
Use `.once()` rather than `.on()` for timeout listener.
Add comment with URL for issue explaining the purpose of the test. (h/t
refack)
PR-URL: #14257Fixes: #14241
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
MylesBorins pushed a commit that referenced this pull request Sep 5, 2017
Use `.once()` rather than `.on()` for timeout listener.
Add comment with URL for issue explaining the purpose of the test. (h/t
refack)
PR-URL: #14257Fixes: #14241
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
@Trott
Trott deleted the fix-can-reset-timer branch January 13, 2022 22:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

netIssues and PRs related to the net subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: flaky test-net-can-reset-timeout

8 participants

@Trott@refack@addaleax@cjihrig@hiroppy@mscdex@MylesBorins@nodejs-github-bot