Skip to content

Conversation

@license2e
Copy link

Signed-off-by: Ilya Shindyapin ilya@shindyapin.com

Motivation

#11457

Test Plan

Without the change react-native run-xxx takes a LONG time to start the simulator, with the change, it is almost instantly...

Also, running nc -w 5 -z localhost 8081 inside the terminal take a LONG time to run, while nc -w 5 -z 127.0.0.1 8081 is almost instant.

Signed-off-by: Ilya Shindyapin <ilya@shindyapin.com>
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: review-needed labels Apr 18, 2017
@hramos
Copy link
Contributor

hramos commented Apr 27, 2017

$ time nc -w 5 -z 127.0.0.1 8081
real	0m0.007s
user	0m0.002s
sys	0m0.004s

$ time nc -w 5 -z localhost 8081
real	0m0.010s
user	0m0.002s
sys	0m0.004s

The difference is negligible on my system. Are you certain this is the right fix here?

@license2e
Copy link
Author

@hramos It could be just my system or settings (see results below), but if this is happening to others, then it would affect how they develop using react-native. Also, if it makes no difference, then why not?

Here is the output on my system, without anything running on port 8081 (it seems to get slower every time I run it):

$ time nc -w 5 -z 127.0.0.1 8081

real	0m0.008s
user	0m0.002s
sys	0m0.002s

$ time nc -w 5 -z localhost 8081

real	10m4.935s
user	0m0.002s
sys	0m0.004s

@license2e
Copy link
Author

If I add the -n flag:

-n' Do not do any DNS or service lookups on any specified addresses, hostnames or ports.
$ time nc -n -w 5 -z localhost 8081
nc: getaddrinfo: nodename nor servname provided, or not known

real	0m0.006s
user	0m0.002s
sys	0m0.003s

@license2e
Copy link
Author

If I do have something running on localhost:8081 (ie, an existing React Native project)

$ time nc -w 5 -z localhost 8081
Connection to localhost port 8081 [tcp/sunproxyadmin] succeeded!

real	0m0.026s
user	0m0.009s
sys	0m0.009s

@javache
Copy link
Member

javache commented May 19, 2017

This could be a misconfiguration of your system. Could you check if your /etc/hosts file contains an entry for localhost?

@facebook-github-bot
Copy link
Contributor

@license2e I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@hramos hramos closed this Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants