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

Indonesian Dark Wordlist

Indonesian Dark Wordlist adalah proyek baru dari Unlisted Developer yang menghasilkan kumpulan kata (wordlist) berbasiskan pada Kamus Besar Bahasa Indonesia (KBBI) untuk berbagai keperluan, misalnya teknik bruteforce atau aircracking . Kami masih melihat proyek-proyek sebelumnya masih tidak jelas kelanjutan proyeknya dalam membuat Wordlist, maka dari itulah kami membuat proyek ini sebagai jembatan kepada teman-teman lain yang membutuhkan wordlist yang lengkap tanpa harus bersusah-susah meng- generate . Mengingat proyek ini masih dalam tahap awal, maka banyak sekali kelemahan-kelamahan yang ada, sehingga kami mengharapkan kritik dan saran yang membangun, supaya kami bisa berbenah dalam setiap tambahan waktu. Selain itu, kami juga masih membuka peluang kepada teman-teman yang ingin bergabung dalam proyek ini, silahkan menghubungi saya via email atau tinggalkan komentar pada tulisan ini. Tidak ada syarat ketentuan khusus, hanya syarat umum yaitu bisa mengoperasikan komputer (mengerti...

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 ...

Bypassing Nokia Drive N9

Nokia N9 contains maps application bundled by Nokia with offline maps, but to access Drive application you need to have Nokia Account and you must login in your N9. Before Nokia Account has been shutdown by Microsoft (see here ) there's no problem to using Nokia Maps on N9, but after 25th, April 2015 Nokia Account no longer can be accessed. So maybe you think that your N9 can't help you to assist when you driving or find place around the world. Nokia Account requirement Here, I'll show you to bypassing Nokia Account requirement to access Nokia Drive on N9 Harmattan. So you don't need to have Nokia Account logged on your N9 to access Nokia Drive. Below is the step by step to bypassing by modify Nokia Drive configuration on Harmattan. First, you'll need installed Filebox on your Harmattan N9 (see here  for installer and this  for installation). Open Filebox and make sure you have change settings to Show root filesystem and Show hidden files. Filebox Sett...