Closed
Description
The current logger startup can be quite slow on a fresh OSX install. The root cause is:
InetAddress.getLocalHost().getHostName()
in StartupInfoLogger
See for workaround and background https://thoeni.io/post/macos-sierra-java/
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
wilkinsona commentedon Oct 5, 2016
I don't think we should be trying to work around this. The underlying cause has been in Java for some time. I believe it's appearing more frequently now due to the (mis)configuration of macOS after an upgrade to Sierra. It's also happened in the past with other macOS upgrades.
When you request a hostname, the JDK resolves it to IP addresses. It then tries a reverse lookup of those addresses and checks that at least one of the results maps back to the input host name. It's this reverse lookup that's slow. The slowness isn't limited to the JVM. Anything on the OS that tries to perform such a reverse lookup will be slow without appropriate configuration in
/etc/hosts
.snicoll commentedon Oct 5, 2016
For the record, I was about to write something similar this morning and forgot. I don't think we should try to find a workaround in our codebase for this.
philwebb commentedon Oct 6, 2016
I was hoping there would be a system property that we could use, but I can't find one. I can't get the lookup to slow down locally, but I wondered if this would be an option:
It's probably too hacky!
philwebb commentedon Oct 6, 2016
Another option might be to call
InetAddress.getLocalHost().getHostName()
in a thread with and timeout if we don't get an answer quickly.spencergibb commentedon Oct 6, 2016
@philwebb we use another thread in InetUtils in spring cloud.
wilkinsona commentedon Oct 6, 2016
They're all point solutions for a JVM- or even OS- wide problem. People will almost inevitably hit another call to
getHostname()
that's slow and fix their network configuration. At that point we're needlessly using a reflective hack or spawning a thread. I really don't think we should.haskovec commentedon Oct 8, 2016
wilkinsona commentedon Oct 10, 2016
philwebb commentedon Oct 11, 2016
haskovec commentedon Oct 11, 2016
haskovec commentedon Oct 11, 2016
philwebb commentedon Oct 11, 2016
32 remaining items