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

Add warning for slow hostname lookups on OS X #3766

Merged
merged 1 commit into from Jun 6, 2018
Merged

Conversation

@eatkins
Copy link
Contributor

eatkins commented Nov 24, 2017

I spent a lot of time debugging why it took 5 seconds to run tests each
time. It turns out that if the hostname is not set explicitly on os x,
then getaddrinfo takes 5 seconds to try (and fail) to resolve the dns
entry for the localhostname. This is easily fixed by setting the
hostname, but it is not at all easy to figure out that a slow hostname
lookup is the reason why tests are slow to start.

I don't know if this is a common issue on other platforms, so only issue
the warning on OS X.

Related to #1506

(See the guidelines for contributing, linked above)

@lightbend-cla-validator
Copy link

lightbend-cla-validator commented Nov 24, 2017

Hi @eatkins,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement:

http://www.lightbend.com/contribute/cla

@eatkins
Copy link
Contributor Author

eatkins commented Nov 24, 2017

I signed the Lightbend Contributors Licence Agreement.

@eatkins eatkins force-pushed the eatkins:hostname branch 4 times, most recently from 47ba411 to 2cb2aef Nov 25, 2017
@dwijnand
Copy link
Member

dwijnand commented Nov 28, 2017

Given the only use of the hostname is to embed it into the JUnit results XML, what if we just avoid the whole pitfall and use "localhost"?

@eatkins
Copy link
Contributor Author

eatkins commented Nov 28, 2017

@dwijnand My concern with changing the behavior is that users with multiple build agents may rely on the hostname field to determine on which machine their tests ran. An alternative approach would be to make the machine name configurable in the project settings and switch to using localhost by default. This would require existing users to update the machine name when they upgrade sbt though.

@dwijnand
Copy link
Member

dwijnand commented Jun 6, 2018

@eatkins OK! Do you want to resolve the merge conflict, or shall I?

@eatkins eatkins force-pushed the eatkins:hostname branch from 2cb2aef to 6c0830e Jun 6, 2018
@eatkins
Copy link
Contributor Author

eatkins commented Jun 6, 2018

Resolved.

I spent a lot of time debugging why it took 5 seconds to run tests each
time. It turns out that if the hostname is not set explicitly on os x,
then getaddrinfo takes 5 seconds to try (and fail) to resolve the dns
entry for the localhostname. This is easily fixed by setting the
hostname, but it is not at all easy to figure out that a slow hostname
lookup is the reason why tests are slow to start.

I don't know if this is a common issue on other platforms, so only issue
the warning on OS X.
@eatkins eatkins force-pushed the eatkins:hostname branch from 6c0830e to 27e9360 Jun 6, 2018
@dwijnand dwijnand added this to the 1.2.0 milestone Jun 6, 2018
Copy link
Member

dwijnand left a comment

Thanks @eatkins!

@dwijnand dwijnand merged commit 1d7b35b into sbt:1.x Jun 6, 2018
3 checks passed
3 checks passed
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@eatkins eatkins deleted the eatkins:hostname branch Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.