Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ freezes for about 30 seconds before debugging

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

like image 630
Thomas Avatar asked Jun 03 '15 16:06

Thomas


People also ask

Why does IntelliJ debugger take so long?

Remove breakpoints off your method and use them inside the method as that can cause your debug to take a very long time. Try running IntelliJ as admin. I had this issue at work where debugging was extremely slow and running as admin actually made it a lot faster.

Why debug is not working in IntelliJ?

To solve this, simply remove the jar of the debugged module from all modules' dependencies in the Project Structure. If you do not know which modules have the debugged module jar as dependencies, you can use some tools (Eg. Sublime Text, bash, ...) to search for the module name which is stored in Intellij *.

Why are method breakpoints slow?

Method breakpoints will slow down debugger a lot because of the JVM design, they are expensive to evaluate. Remove method breakpoints and consider using the regular line breakpoints. To verify that you don't have any method breakpoints open .

Where is run debug configuration in IntelliJ?

From the main menu, select Run | Edit Configurations. Alternatively, press Alt+Shift+F10 , then 0 . on the toolbar or press Alt+Insert . The list shows the run/debug configuration templates.


3 Answers

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
like image 88
Shawn Lu Avatar answered Oct 10 '22 16:10

Shawn Lu


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

like image 39
danhnn.uit Avatar answered Oct 10 '22 16:10

danhnn.uit


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.

like image 8
Thomas Avatar answered Oct 10 '22 15:10

Thomas