35

Intelliji idea is very slow in debug mode and it is running perfectly in normal mode.

I already tried by setting the below thing in /etc/hosts file sudo nano /etc/hosts and add these two entries.

127.0.0.1 .local ::1 .local

But it did not work out for me.

Any help on this is highly regarded.

swathi
  • 473
  • 1
  • 4
  • 11

15 Answers15

37

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.

Method breakpoints may dramatically slow down debugging

There is a simple explanation from the IntelliJ Team: "Method breakpoints will slow down debugger a lot because of the JVM design, they are expensive to evaluate"

https://intellij-support.jetbrains.com/hc/en-us/articles/206544799-Java-slow-performance-or-hangups-when-starting-debugger-and-stepping

Languoguang
  • 2,166
  • 2
  • 10
  • 15
Moe
  • 2,672
  • 10
  • 22
  • 2
    I cleared all the breakpoints and set a break point for a line which is inside the method but still it is very slow.I am running intellij as admin – swathi Sep 20 '17 at 00:03
  • Maybe reinstall jdk and IntelliJ? – Moe Sep 20 '17 at 00:05
  • if i ran normal java application ,it is working fine.If I run appium testcases with intelliji then the debugger is slow – swathi Sep 22 '17 at 04:48
  • 3
    Can you please confirm if you have any breakpoints set? open up the breakpoint window in IntelliJ and make sure there is nothing set. let me know the outcome and I'll try to assist further. `Run --> View Breakpoints`. If you find any, remove them all then try run debug again (is it still slow?) – Moe Sep 22 '17 at 05:22
  • I removed all the breakpoints and tried to run it .But it is still slow in debug mode with appium but it is running fine for normal java application. – swathi Sep 25 '17 at 01:30
  • Can you try to isolate the issue to determine what exactly is slow? is it certain parts of the code? is it initializing the tests? is it certain calls that are giving you performance problems? – Moe Sep 25 '17 at 02:40
  • Automate any mobile app test either android or iOS using appium with java and try to debug the code.Then it is taking 1 or 3 minutes to step over to the next step and fetch the variable values.Hover the mouse on any variable is also not working. – swathi Sep 25 '17 at 05:29
  • In my case it was an accidentally set Java Field Watchpoint (breakpoint for an instance variable), removing it solved the slowness issue in debug mode. – Heezer Jul 29 '22 at 10:28
22

If you disable this options in Build, Execution, Deployment -> Debugger -> Data Views --> Java, things will start work faster when debugging.

enter image description here

Eyal Sooliman
  • 1,876
  • 23
  • 29
  • 5
    My issue was the `toString()`. My suspicion is that it got confused by lazily loaded database entity attributes. I wish there was an extra option there to "Disable 'toString()' object view For classes from the list". I would add all my entities there to be sure that's the issue – Guilherme Taffarel Bergamin Jul 09 '21 at 21:28
21

I had the similar issue. In my case it was method breakpoints. There was just one break point on a method. My spring boot app took around 20 mins to launch. When I removed the breakpoints it took 4 seconds to launch.

I also changed the debugger settings.

  1. Unchecked - Enable alternative view view for Collections classes
  2. Unchecked - Enable 'toString()' object view:

but these settings didn't make a difference.

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
Arul Rozario
  • 679
  • 1
  • 9
  • 20
  • I also faced similar issue... but i had breakpoint at field level. the sprint boot application took 10 times more than normal boot time.. – Narendra Reddy Sep 26 '19 at 05:31
5

clicked on "Mute Breakpoints" and started it and it started like as if starting in normal mode(means no any delay)

enter image description here

Ole Pannier
  • 3,208
  • 9
  • 22
  • 33
Jayant
  • 101
  • 1
  • 5
4

I have solved a similar problem by disabling breakpoints; it was remote debugging. I did not make any performance measurements, but it looks like it is ok to have about 10 active breakpoints, but disastrous to have about 100 of them (I guess, the breakpoint list is sent over the network).

Idea lets you to group breakpoints and disable the whole groups.

Note that a click on the wrong mouse button clears your breakpoint instead of letting you edit its condition, so be careful!

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
2

I also faced same problem, after deleting all breakpoints it started working fine.

ajayramesh
  • 3,576
  • 8
  • 50
  • 75
1

Make sure that you don't use "biz.paluch.logging.gelf.logback.GelfLogbackAppender" among your logs. In my case usage of such kind of appender was the cause of drastically slow starting in debug mode.

Andrew Gans
  • 700
  • 6
  • 9
1

In my case I just had to disable the option: "Show method returns values" Image of the option

Leonardo
  • 31
  • 3
0

I faced similar problem with the Eclipse also and found the solution. It is happening because your IntelliJ is using online Java and not using the same which is installed in your system.

You should set the java path to your system one in the IntelliJ configuration. Below link will help you for the same:
https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under

Hope this will help you. :-)

Aman
  • 735
  • 1
  • 6
  • 19
0

Remove breakpoint from DAO interface and all work nice!

Ivan
  • 2,316
  • 2
  • 24
  • 22
0

In my case, slowness is specific to REST calls. After testing all of the above proposed solutions, I finally find a way to remove these slowness issues by switching my JDK from JDK 11 to JDK 8.

Note: The same slowness appears in Visual Studio Code. This seems related to JDK 11 (OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode) on macOS)

Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
0

In my case i had more than 100 breakpoints active and this was the cause of this issue.
I clicked Ctrl + Alt + F8 and disabled all the breakpoints.
After that i enabled few new breakpoints i needed and all was ok.
It seems that having a lot of active breakpoints causes this issue.

alext
  • 678
  • 1
  • 11
  • 25
0

Removing all Interface method breakpoints will fix the long spring boot startup Idea debug run.

alexcorghencea
  • 341
  • 3
  • 12
0

In my case the problem was caused by the "Threads" view. When I remove this view it becomes fast again.

When I add the Threads view, I continuously see "Collecting data..." in the threads view, it flickers every 5s where the threads list shows for a moment then it goes back to "Collecting data...". When its like this, stepping through the code is painfully slow - takes about 10s for each step.

Martin Devlin
  • 71
  • 1
  • 1
0

I cam across this post looking for a solution for my CLion (Rust). I removed all breakpoints, and it was enough to make the starting time on the debug mode too quick again.

Thanks to everyone who suggested that. This suggestion does not work only for Java, it also works for Rust/Clion

Seeker
  • 75
  • 1
  • 5