49

when i try to debug my java app the IDE freezes for about 30 seconds with the message: "Finished, saving caches"

After it unfreezes all works fine. It happens every time.

When i only run (not debug) it does not freeze.

What i tried:

  • I changed the JDK on system.
  • I changed the IntelliJ version.
  • I change to IntelliJ Ultimate - trial.
  • Invalidating the IDE's cache.
  • Similar problem
  • I also figured out that the given message exists only it this area of code - github-project so i changed the JVM options to give InteliJ more ram.

InteliJ build IC-141.1010.3.

When i try to debug in other IDE's it works fine, only InteliJ gets stuck...

I submitted a ticket to jetbrains too, but i know the power of StackOverflow :)

I have a MacBookPro 2015 and JDK 1.8

Community
  • 1
  • 1
Thomas
  • 2,131
  • 2
  • 20
  • 23
  • 2
    The logs are stored in ~/.IntelliJIdea14/system/log/idea.log (there's a built-in log rotation). Seeing anything suspicious there? By reviewing it, you can also be sure which java it is using. (On Mac, the location is rather different). – Kedar Mhaswade Jun 03 '15 at 20:05
  • 2
    The logs indicated that there was a hang within java.net.Inet4AddressImpl.getLocalHostName(Native Method). – Thomas Jun 05 '15 at 20:29
  • Awesome thanks for the hint, @fane89, I had the issue with the hostname as well. http://stackoverflow.com/questions/1881546/inetaddress-getlocalhost-throws-unknownhostexception – FloWi Sep 23 '16 at 12:45
  • 1
    The accepted answer is not the solution, the other answer is. http://stackoverflow.com/a/39971232/3679676 You can change the accepted answer to reflect this and help people out with the issue. – Jayson Minard Apr 25 '17 at 10:27

3 Answers3

97

If anyone else is still having this problem, I found this related issue on the IntelliJ board: https://youtrack.jetbrains.com/issue/IDEA-157303

It seems the problem is related to resolving hostnames. The recommended workaround is to include the following line in your /etc/hosts file:

127.0.0.1       localhost     <your hostname goes here>.local

And for IPv6 resolving, the same:

::1             localhost     <your hostname goes here>.local
Jayson Minard
  • 84,842
  • 38
  • 184
  • 227
Shawn Lu
  • 1,556
  • 11
  • 11
26

Well, the issue took me around 3 hours to find out how to overcome it. For anyone has tried "modifying etc host file" solution from Jayson Minard and still not worked. Just go to SystemPreference -> Sharing and turn on File Sharing. That's on and it will let you debug your Java app on IntelijIdea 2017 very very very fast !!!!!!

enter image description here

danhnn.uit
  • 1,784
  • 1
  • 14
  • 7
8

The support from IntelliJ told me to try the IDE with bundled java.

http://download.jetbrains.com/idea/ideaIC-14.1.3-custom-jdk-bundled.dmg

And it works!

Edit:

IntelliJ support feedback: The problem was that there was a hang within java.net.Inet4AddressImpl.getLocalHostName(Native Method) JDK method call, which gets your system hostname. This is either JDK problem or local configuration issue...

The solution for this is here.

Community
  • 1
  • 1
Thomas
  • 2,131
  • 2
  • 20
  • 23