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.
cd hello-world-java && ./gradlew runIt should start accepting connections in about one second. I.e. prints the "Server Running" line.
It starts to accept connections after about 76 seconds. Sometimes after 151 seconds.
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)
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.
Most helpful comment
Yep, that does resolve/workaround it:
Thanks!