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

document that the port may not be immediately available for (re-)use #15

Closed
tarun opened this issue Nov 27, 2017 · 3 comments
Closed

document that the port may not be immediately available for (re-)use #15

tarun opened this issue Nov 27, 2017 · 3 comments

Comments

@tarun
Copy link

tarun commented Nov 27, 2017

since getPort reserves a port and releases it to find an unused port number - trying to use that port number immediately afterwards may not work as *nix machines, which have a re-use timeout for the port to be available again.

This issue is for adding some documentation describing this behavior (if appropriate).

Related post:
https://unix.stackexchange.com/questions/17218/how-long-is-a-tcp-local-socket-address-that-has-been-bound-unavailable-after-clo

@tarun
Copy link
Author

tarun commented Nov 27, 2017

As per docs nodejs sets the option SO_REUSEADDR
https://nodejs.org/dist/latest-v8.x/docs/api/net.html#net_server_listen

@tarun
Copy link
Author

tarun commented Nov 28, 2017

A few more posts while I am debugging this on Ubuntu 14.04 Trusty and learning about BSD Socket Options SO_REUSEPORT and SO_REUSEADDR

https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t
nodejs/node#2604 (comment)
http://man7.org/linux/man-pages/man7/socket.7.html

@tarun
Copy link
Author

tarun commented Nov 28, 2017

nevermind. I had a bug in my script - was starting the same server twice, instead of switching over and starting another item (was missing a git submodule argument).

The above doesn't seem to be a real issue since node always sets SO_REUSEADDR

@tarun tarun closed this as completed Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant