Skip to content

test: fix race in test-net-socket-local-address - #4052

Closed
Trott wants to merge 1 commit into
nodejs:masterfrom
Trott:fix-race
Closed

test: fix race in test-net-socket-local-address#4052
Trott wants to merge 1 commit into
nodejs:masterfrom
Trott:fix-race

Conversation

@Trott

Copy link
Copy Markdown
Member

test-net-socket-local-address had a race condition that resulted in
unreliability on FreeBSD. This changes fixes the issue.

Fixes: #2475

test-net-socket-local-address had a race condition that resulted in
unreliability on FreeBSD. This changes fixes the issue.
Fixes: nodejs#2475
@TrottTrott added test Issues and PRs related to the tests. freebsd Issues and PRs related to the FreeBSD platform. labels Nov 27, 2015
@evanlucas

Copy link
Copy Markdown
Contributor

LGTM if CI is happy

@Trott

Copy link
Copy Markdown
MemberAuthor

Here's 28 failures in 129 runs of the test without this fix on FreeBSD: https://ci.nodejs.org/job/node-test-commit-freebsd/437/nodes=freebsd102-64/console

And here's 10000 successful runs without a single failure with this fix on FreeBSD: https://ci.nodejs.org/job/node-test-commit-freebsd/436/nodes=freebsd102-64/console

@mscdexmscdex added the net Issues and PRs related to the net subsystem. label Nov 27, 2015
@Trott

Copy link
Copy Markdown
MemberAuthor

@jbergstroem

Copy link
Copy Markdown
Member

LGTM. One less flaky test \o/

@Trott

Copy link
Copy Markdown
MemberAuthor

Looks like this one is also currently flaky on Windows, so this fix isn't just for FreeBSD's benefit. Woot.

https://ci.nodejs.org/job/node-test-binary-windows/163/RUN_SUBSET=3,VS_VERSION=vs2015,label=win2012r2/tapTestReport/test.tap-142/

@bnoordhuis

Copy link
Copy Markdown
Member

I don't understand where the race condition comes from. Does a 'close' event get lost somehow?

@Trott

Copy link
Copy Markdown
MemberAuthor

@bnoordhuis Either a server close event got lost or else it was just that the client close was firing new testConnect() connections before the server close event fired and caught up the conns count to know when to stop things. This happened infrequently and apparently only on FreeBSD. But it was enough to make the test flaky on FreeBSD.

@Trott

Copy link
Copy Markdown
MemberAuthor

Continues to afflict Windows without this fix: https://ci.nodejs.org/job/node-test-binary-windows/165/RUN_SUBSET=3,VS_VERSION=vs2015,label=win2012r2/tapTestReport/test.tap-142/

Guess I better run a stress test on Windows with this fix to make sure it works there too. (I had only run it on FreeBSD before.): https://ci.nodejs.org/job/node-stress-single-test/73/nodes=win2012r2/console

@Trott

Copy link
Copy Markdown
MemberAuthor

Stress test worked out A-OK on Windows. Seems ready to land, unless...

@bnoordhuis Was your question just a question or an expression of concern that my response doesn't adequately address? I'd like to land this if it was just the former, but will hold off if the latter.

@bnoordhuis

Copy link
Copy Markdown
Member

I had a look at the test and I believe there is a simpler way to fix the flakiness: #4078

@Trott

Trott commented Dec 1, 2015

Copy link
Copy Markdown
MemberAuthor

Simpler solution in #4078 appears to solve the problem for Windows but not FreeBSD. Details over there. Maybe it just needs a small tweak or something.

@Trott

Trott commented Dec 1, 2015

Copy link
Copy Markdown
MemberAuthor

Alternate solution that doesn't involve creating a Boolean and adding special logic based on it: #4109 Yay, three competing PRs!

@Trott

Trott commented Dec 2, 2015

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #4109

@TrottTrott closed this Dec 2, 2015
@Trott
Trott deleted the fix-race branch January 13, 2022 22:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

freebsdIssues and PRs related to the FreeBSD platform.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.

Investigate flaky test test-net-socket-local-address

5 participants

@Trott@evanlucas@jbergstroem@bnoordhuis@mscdex