diff --git a/docs/source/getting-set-up-fault-finding.rst b/docs/source/getting-set-up-fault-finding.rst index bd92828d3b..affa9accb5 100644 --- a/docs/source/getting-set-up-fault-finding.rst +++ b/docs/source/getting-set-up-fault-finding.rst @@ -128,7 +128,7 @@ Other common issues Slow localhost resolution ************************* -Out of the box, Apple Mac's have machine names that end in ".local", by default something like "MacBook-Pro.local". +Out of the box, Apple Macs have machine names that end in ".local", by default something like "MacBook-Pro.local". This can cause long delays with starting Corda nodes as every attempt to look up the name of the local computer triggers a five second pause. This is not a bug in Corda but rather `a problem with the macOS networking stack `_. diff --git a/node/src/main/kotlin/net/corda/node/Corda.kt b/node/src/main/kotlin/net/corda/node/Corda.kt index 2e607a821f..2c82417d80 100644 --- a/node/src/main/kotlin/net/corda/node/Corda.kt +++ b/node/src/main/kotlin/net/corda/node/Corda.kt @@ -3,7 +3,6 @@ package net.corda.node import com.jcabi.manifests.Manifests -import com.sun.org.apache.xml.internal.serializer.utils.Utils.messages import com.typesafe.config.ConfigException import joptsimple.OptionException import net.corda.core.* @@ -25,7 +24,6 @@ import java.net.InetAddress import java.nio.file.Paths import java.util.* import kotlin.system.exitProcess -import kotlin.system.measureTimeMillis private var renderBasicInfoToConsole = true @@ -125,7 +123,7 @@ fun main(args: Array) { log.info("bootclasspath: ${info.bootClassPath}") log.info("classpath: ${info.classPath}") log.info("VM ${info.vmName} ${info.vmVendor} ${info.vmVersion}") - checkForSlowLocalhostResolution() + log.info("Machine: ${lookupMachineNameAndMaybeWarn()}") log.info("Working Directory: ${cmdlineOptions.baseDirectory}") val agentProperties = sun.misc.VMSupport.getAgentProperties() if (agentProperties.containsKey("sun.jdwp.listenerAddress")) { @@ -166,7 +164,7 @@ fun main(args: Array) { exitProcess(0) } -private fun checkForSlowLocalhostResolution() { +private fun lookupMachineNameAndMaybeWarn(): String { val start = System.currentTimeMillis() val hostName: String = InetAddress.getLocalHost().hostName val elapsed = System.currentTimeMillis() - start @@ -188,6 +186,7 @@ private fun checkForSlowLocalhostResolution() { print(Ansi.ansi().reset()) } } + return hostName } private fun assertCanNormalizeEmptyPath() {