Skip to main content

[FIXED] Java MacOS Hostname

During the development of Caltic, there is a strange from internal logger of Vert.x (our toolkit to build Caltic Systems). There're some warning log indicate something happen abnormally. See below:
[INFO] Nov 08, 2018 5:24:50 PM io.vertx.core.impl.launcher.commands.Watcher
[INFO] INFO: Watched paths: [/Users/myrepublic/devel/caltic/caltic-train/target/classes]
[INFO] Nov 08, 2018 5:24:50 PM io.vertx.core.impl.launcher.commands.Watcher
[INFO] INFO: Starting the vert.x application in redeploy mode
[INFO] Starting vert.x application...
[INFO] 18b3e3d3-043d-4f63-b8aa-52d018554b6a-redeploy
[INFO] Nov 08, 2018 5:24:53 PM io.vertx.core.impl.BlockedThreadChecker
[INFO] WARNING: Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 2858 ms, time limit is 2000
[INFO] Nov 08, 2018 5:24:54 PM io.vertx.core.impl.BlockedThreadChecker
[INFO] WARNING: Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 3859 ms, time limit is 2000
[INFO] Nov 08, 2018 5:24:55 PM io.vertx.core.impl.BlockedThreadChecker
[INFO] WARNING: Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 4863 ms, time limit is 2000
[INFO] Nov 08, 2018 5:24:58 PM io.vertx.core.impl.BlockedThreadChecker
[INFO] WARNING: Thread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 2520 ms, time limit is 2000
[INFO] Nov 08, 2018 5:24:59 PM io.vertx.core.impl.BlockedThreadChecker
[INFO] WARNING: Thread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 3524 ms, time limit is 2000
[INFO] Nov 08, 2018 5:25:00 PM io.vertx.core.impl.BlockedThreadChecker
[INFO] WARNING: Thread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 4524 ms, time limit is 2000
It was happen when I upgraded macOS Sierra to macOS Mojave and along with it also upgraded JDK 1.8_171 to 1.8_181. For several weeks, I think it's not cause serious problem since the logs doesn't appear when the apps deployed to Heroku.
Later when I read Vert.x Core Manual, I carried to actor model and one of them that using actor model is Akka. Yeah, one year ago when I did research on Play Framework, the web framework for Java and Scala, I also found Akka, but I didn't found Akka deeper, when read one by one topic in Play. But now I understand that Play is only one implementation module (Akka Http) from many modules that Akka have, like Akka Actors, Akka Streams, etc. Back to the topic, when I tried the Lagom Framework, the new brand from Lightbend for microservice purpose, I also notified that something happen when starting Http Server. In the warning logs from Lagom, there is an url recommendation to solve this issue, here. Then the investigation is started.
After cloned git repository from the url above and run it on my machine, I got:
$ java -jar bin/inetTester.jar
Calling the hostname resolution method...
Method called, hostname Heru-MacBook-Pro.local, elapsed time: 5011 (ms)
Wow it's take a time 5 sec to getting the hostname, too long. Based on the url from Lagom logs, the proposed solution is fixed file /etc/hosts. The file should be consists of:
127.0.0.1   localhost Heru-MacBook-Pro.local
::1         localhost Heru-MacBook-Pro.local
The format above is <ip><localhost><hostname>. The hostname is grabbed from inetTester logs above, in my case is Heru-MacBook-Pro.local. Actually I'm using vim to edit this file, but if you don't familiar with them, you could using echo.
$ sudo echo "127.0.0.1 localhost Heru-MacBook-Pro.local" > /etc/hosts && sudo echo "::1 localhost Heru-MacBook-Pro.local" >> /etc/hosts
When password is asked, type on the terminal then enter. After you running these command, you could verify with cat command.
$ cat /etc/host
127.0.0.1   localhost Heru-MacBook-Pro.local
::1         localhost Heru-MacBook-Pro.local
Ok the proposed solution has been run, now time to verify. We can move to inetTester app again, run it:
$ java -jar bin/inetTester.jar
Calling the hostname resolution method...
Method called, hostname Heru-MacBook-Pro.local, elapsed time: 8 (ms)
Amazing, you see it? It's only take time 8 mili-sec, so faster than before (5 sec). Now let's try the caltic app.

Vert.x Application Log

No blocked thread anymore. Since the threshold of each event loop from vertx is 2000 ms, so if your code is taken more time to be processed than the threshold, the warning log should be appeared, otherwise.
Case Closed!

Comments

Popular posts from this blog

Fixing Ralink Driver on Kali Linux

Okay, now i'm going to make Kali Linux as primary OS on my laptop, not longer Backtrack. Yes, i have decided to migrate from Backtack into the new version of Backtrack, named Kali Linux. This is my first tutorial of Kali Linux on my blog. So let's begin to fixing an error about Ralink wireless driver when we installing Kali Linux. Kali Linux Desktop When we are on the network configuration page from installation Kali Linux, the PC which used Ralink wireless will be notice that the driver need external source to be installed at installation of Kali Linux, in order to the wireless work normally. To satisfy that condition, we need the external source which contain anything about Ralink driver. As we know, Kali Linux is based on Debian Wheezy, so i was searching all about Ralink wireless driver. Ahaaa, when i had read from one of them, i found the package (see  http://wiki.debian.org/WiFi ). Let's try to identify where our file which we needed. On this tutorial, we w

Share Connection eth0 on Kali

When I was still using Backtrack as pentest Operating System on my netbook, I need to configure everything about networking, include sharing connection over eth0 interface. I must type on the terminal to set up the interface, then set the IP and netmask, etc. After setting the interface connection, I also must to configure  iptables to forwarding the internet connection from the other interface into eth0 , and the last step I must turn on forwarding rule. It's really fun, although need several step to do it. But, when I am using Kali Linux, I realise that the step which can I do on backtrack doesn't running on Kali Linux. After learn several option about networking on Kali, finally I can share connection over eth0 on Kali Linux. Okay, the first assume that we must have connected internet (not using eth0 ). Next, when your connection are ready, you can right click on the networking icon, select Edit Connection. Edit Connection When the window "Networking Connectio

Bypassing Nokia Maps N9

Nokia N9 have maps application, both of Nokia Maps and Nokia Drive are related one to other. But the same problem with Nokia Drive on Nokia N9 also occur in Nokia Maps (see here ). Nokia Maps also need logged in Nokia Account before you can use Nokia Maps. So I think the same way with bypassing Nokia Account in Nokia Drive will be succeed too in Nokia Maps. The same step can be read on my previous post here , until preparing the configuration Nokia Drive download. Okay let's go! First, make sure you have installed Filebox and setting to show hidden files and show root filesystem. Open browser on your N9 and download Modified Nokia Maps Configuration here . Don't press clear when the download has finished, just tap Done. Go to Filebox, and navigate to /home/user/MyDocs/Downloads , you'll found Maps.conf there, copy and paste this file into /home/user/.config/Nokia . But I recommend you if there's existing Nokia Maps Configuration backup it into Maps.conf.bak the