Micronaut-core: Slow start on macOS

Created on 24 May 2018  路  6Comments  路  Source: micronaut-projects/micronaut-core

I'm seeing really slow start, most often 76 seconds and sometimes 151 seconds, on mac (high sierra 10.13.4 with java 1.8.0_172). A timeout of 75 seconds or something?

This happens 5/5 times when I test. Below repro steps are for the hello-world-java but same happens when following the instructions in the quick guide. Same happens regardless of using java or groovy.

On gitter, it was suggested that this has happened before on mac, and might relate to network configuration. I've been doing java/groovy (java se and ee, spring, grails) backend development for years on mac, and also in node and go, and haven't seen this before, which makes me doubt that. I don't know enough of micronaut internals to google it. Maybe netty is what makes this different?

I've also attached micronaut-trace.log if that helps. Let me know if I can debug this further.

Task List

  • [x] Steps to reproduce provided
  • [x] Stacktrace (if present) provided
  • [x] Example that reproduces the problem uploaded to Github
  • [x] Full description of the issue provided (see below)

Steps to Reproduce

  1. cd hello-world-java && ./gradlew run

Expected Behaviour

It should start accepting connections in about one second. I.e. prints the "Server Running" line.

Actual Behaviour

It starts to accept connections after about 76 seconds. Sometimes after 151 seconds.

Environment Information

  • Operating System: macOS High Sierra: 10.13.4 (17E202)
  • Micronaut Version: local build from git clone of master: 5a6fd3b0a
  • MIcronat Profiles Version: local build from git clone of master: 8a6c0ab5
  • JDK Version: from SDKMAN:
openjdk version "1.8.0_172"
OpenJDK Runtime Environment (Zulu 8.30.0.1-macosx) (build 1.8.0_172-b01)
OpenJDK 64-Bit Server VM (Zulu 8.30.0.1-macosx) (build 25.172-b01, mixed mode)

Example Application

notabug

Most helpful comment

Yep, that does resolve/workaround it:

$ hostname
idev
$ diff -u /etc/hosts.orig /etc/hosts
--- /etc/hosts.orig 2018-05-24 12:22:23.000000000 +0300
+++ /etc/hosts  2018-05-24 12:22:38.000000000 +0300
@@ -4,6 +4,6 @@
 # localhost is used to configure the loopback interface
 # when the system is booting.  Do not change this entry.
 ##
-127.0.0.1  localhost
+127.0.0.1  localhost idev
 255.255.255.255    broadcasthost
-::1             localhost 
+::1             localhost idev

Thanks!

All 6 comments

Just to verify that if I run the same build (java -jar hello-world-java-all.jar) in a container built FROM openjdk:8-jre-alpine, then in the trace I see a more reasonable message:

08:37:12.092 [main] INFO  io.micronaut.runtime.Micronaut - Startup completed in 1785ms. Server Running: http://localhost:8080

This is due to a bug in Mac OS X high Sierra. See https://thoeni.io/post/macos-sierra-java/ for how to resolve it

Yep, that does resolve/workaround it:

$ hostname
idev
$ diff -u /etc/hosts.orig /etc/hosts
--- /etc/hosts.orig 2018-05-24 12:22:23.000000000 +0300
+++ /etc/hosts  2018-05-24 12:22:38.000000000 +0300
@@ -4,6 +4,6 @@
 # localhost is used to configure the loopback interface
 # when the system is booting.  Do not change this entry.
 ##
-127.0.0.1  localhost
+127.0.0.1  localhost idev
 255.255.255.255    broadcasthost
-::1             localhost 
+::1             localhost idev

Thanks!

Working
Should be added to documentation ?

I know this is closed but for anyone running into this: a system update sems to change what hostname command prints, so keep an eye on it. For me, it changed from idev to idev.local and I had to readjust my /etc/hosts file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gitjxm picture gitjxm  路  3Comments

denbilyk picture denbilyk  路  3Comments

Jhraumg picture Jhraumg  路  4Comments

recursivecodes picture recursivecodes  路  5Comments

iBernd81 picture iBernd81  路  3Comments