Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
Remove common.PORT usage from parallel tests #12473
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
thelostone-mc commented Apr 17, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
thelostone-mc commented Apr 17, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
First-time contributor. (Noob level) Thanks for pushing me to get into this! |
vsemozhetbyt commented Apr 17, 2017
thefourtheye commented Apr 18, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Good job @adityaanandmc 👏 |
thefourtheye commented Apr 18, 2017
@adityaanandmc Changes are all good. If you could make sure if the commits follow these guidelines it would be great? |
parallel tests parallel tests thelostone-mc commented Apr 18, 2017
@thefourtheye Do the changes look alright ? |
thelostone-mc commented Apr 18, 2017
@thefourtheye@cjihrig |
cjihrig commented Apr 18, 2017
That would probably introduce a race condition. Once you close the server to release the port, something else can claim that port. |
thelostone-mc commented Apr 19, 2017
@cjihrig What would be the ideal way to get this done? I was aware of the race condition and hence a little stuck. My commit ( code below ) will fail if the race condition is met. |
thefourtheye commented Apr 19, 2017
@adityaanandmc wrote
Although the possibility of this happening is less, it is still possible and we cannot avoid it. |
santigimeno commented Apr 19, 2017
@adityaanandmc what about doing something like this: ... constserver=net.createServer();server.listen(0);constport=server.address().port;constc=net.createConnection(port);server.close(); ... |
thelostone-mc commented Apr 19, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@santigimeno Now i feel like a idiot :P Thanks for that!! :D |
santigimeno commented Apr 19, 2017
@adityaanandmc could you squash the commits into one? Thanks! |
jasnell commented Apr 19, 2017
thelostone-mc commented Apr 19, 2017
@santigimeno will squash them!! I can't seem to understand the failures. I thought about doing this, but it didn't seem like the right thing to do. |
santigimeno commented Apr 19, 2017
@adityaanandmc looking at the changes again it seems that we're trying to |
21c212d to 582ef62Comparethelostone-mc commented Apr 20, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@santigimeno@thefourtheye I did that and it passed locally but at times it fails with the following error! Sorry for flooding you with doubts. Just a lil confused for a first-time contributor on a project of this scale. |
addaleax commented May 6, 2017
I think the actual error in the output you linked to is this: That is unrelated, and was tracked at #12817 (but should be fixed now). Either way, it looks like this PR has a merge conflict now so it might need to rebase – is that something you can do? |
santigimeno commented May 6, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
thelostone-mc commented May 6, 2017
Sure thing !! Will do that in a bit though. ( heading out to watch Guardians of the Galaxy ) :D |
thelostone-mc commented May 7, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@addaleax@santigimeno Rebased!! Thanks for that. Can a CI job be triggered? |
gibfahn commented May 7, 2017
santigimeno commented May 7, 2017
@adityaanandmc sorry to bring this up again, but it would be great if you could address this. Anyway, the PR as it is LGTM. Thanks! |
thelostone-mc commented May 7, 2017
@santigimeno That's alright. I did not see that comment until now. Sorry about that! Updated: Thanks @santigimeno@thefourtheye@Trott@cjihrig !! |
santigimeno commented May 7, 2017
Yes, LGTM. I think another in |
thelostone-mc commented May 8, 2017
@santigimeno Done! |
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.
Okay, server.close is actually asynchronous. Perhaps we should run this test in the close event of server.
santigimenoMay 8, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
Okay, server.close is actually asynchronous
You're right, though the close() is executed syncronously at least on Unixes, but that's an implementation detail.
Perhaps we should run this test in the close event of server.
I think that's not going to work either, because there's going to be a window when the port is not assigned and could be grabbed by some other process/test.
So probably the only way to make this work without race conditions is moving it to sequential. What do you think @thefourtheye ?
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.
@santigimenoclose() is actually executed synchronously, but by the time the connection attempt is made (which happens asynchronously), the port is still up for grab, right? Perhaps I am overthinking 🤔
I am afraid sequential also will not solve this. common.PORT could still have been assigned to other processes.
Perhaps we can live with the current change...
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.
@santigimeno close() is actually executed synchronously, but by the time the connection attempt is made (which happens asynchronously), the port is still up for grab, right? Perhaps I am overthinking 🤔
Yes, I thought of that too. And I think I'm also overthinking 😆 .
I am afraid sequential also will not solve this. common.PORT could still have been assigned to other processes.
Right, but not to other tests in the same run though.
Perhaps we can live with the current change...
Yeah, probably they'll never fail.
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.
Since we've reached a moo point. Would it be alright if I followed @thefourtheye approach and change the code accordingly ?
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.
@adityaanandmc No, move this to sequential, without the changes.
Remove common.PORT from, test-net-connect-immediate-destroy, test-net-options-lookup, test-net-connect-local-error, test-net-connect-handle-econnrefused, test-net-socket-destroy-twice, test-net-better-error-messages-port-hostname, test-net-localerror, to reduce possibility that a dynamic port used in another test will collide with common.PORT. Moved test-net-listen-shared-ports, test-net-better-error-messages-port from tests/parallel to test/sequential Refs: nodejs#12376
thelostone-mc commented May 8, 2017
@thefourtheye Done. CI Build trigger necessary ? |
thefourtheye commented May 9, 2017
Remove common.PORT from, test-net-connect-immediate-destroy, test-net-options-lookup, test-net-connect-local-error, test-net-connect-handle-econnrefused, test-net-socket-destroy-twice, test-net-better-error-messages-port-hostname, test-net-localerror, to reduce possibility that a dynamic port used in another test will collide with common.PORT. Moved test-net-listen-shared-ports, test-net-better-error-messages-port from tests/parallel to test/sequential Refs: #12376 PR-URL: #12473 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
jasnell commented May 9, 2017
Landed in 94eed0f |
Remove common.PORT from, test-net-connect-immediate-destroy, test-net-options-lookup, test-net-connect-local-error, test-net-connect-handle-econnrefused, test-net-socket-destroy-twice, test-net-better-error-messages-port-hostname, test-net-localerror, to reduce possibility that a dynamic port used in another test will collide with common.PORT. Moved test-net-listen-shared-ports, test-net-better-error-messages-port from tests/parallel to test/sequential Refs: nodejs#12376 PR-URL: nodejs#12473 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Remove common.PORT from, test-net-connect-immediate-destroy, test-net-options-lookup, test-net-connect-local-error, test-net-connect-handle-econnrefused, test-net-socket-destroy-twice, test-net-better-error-messages-port-hostname, test-net-localerror, to reduce possibility that a dynamic port used in another test will collide with common.PORT. Moved test-net-listen-shared-ports, test-net-better-error-messages-port from tests/parallel to test/sequential Refs: #12376 PR-URL: #12473 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Remove common.PORT from, test-net-connect-immediate-destroy, test-net-options-lookup, test-net-connect-local-error, test-net-connect-handle-econnrefused, test-net-socket-destroy-twice, test-net-better-error-messages-port-hostname, test-net-localerror, to reduce possibility that a dynamic port used in another test will collide with common.PORT. Moved test-net-listen-shared-ports, test-net-better-error-messages-port from tests/parallel to test/sequential Refs: #12376 PR-URL: #12473 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Refs: #12376
Tests Updated:
Tests ported from test/parallel to test/sequential:
Analyzed and continuing to use common.PORT
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test