Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ debugger gets stuck

I'm debugging a normal Java application, no GUI, just a lot of computations and ~5 calls in the stack for the main thread when the problem occurs. Basically it keeps saying "Collecting data" in the local variable watch.

enter image description here

So instead of going step-by-step I've tried to add a breakpoint immediately after an press "Resume". Now it says "Waiting until last debugger command completes". enter image description here

Have anyone had this problem before? Is changing the debugger the only way to figure this out?

like image 255
Luca Mozzo Avatar asked Jun 16 '16 15:06

Luca Mozzo


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 my debugger 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 *.

How do I get out of loop while debugging in IntelliJ?

The only way to do that is to set a break point outside the loop, or position the cursor outside the loop and do "run until cursor".

Why IntelliJ is very slow?

Increase memory for IntelliJ IDEA By default, the IDE requests a maximum of 2048 MB. You can change this option in Help → Change memory settings. According to the feedback from some of our users and colleagues with big projects, changing the option to 8GB significantly improves IDE performance.


2 Answers

On IntelliJ (2017.1.4 Community Edition), the following fixed the problem for me:

  • File->Settings
  • Type in "toString"
  • Navigate to Build, Execution, Deployment->Debugger->Data views->Java
  • Find the "Enable 'toString()' object view:" checkbox
  • Uncheck the box

Re-run the debugger.

like image 195
CharlieB Avatar answered Sep 23 '22 12:09

CharlieB


The following fixed it for me on IntelliJ 2018.2.4:

  • Right click breakpoint
  • Toggle the setting to suspend "Thread" instead of "All"

This won't be helpful if you actually need to suspend all the threads for debugging, but it got rid of the "Collecting data..." and "Waiting until last debugger command completes" messages for me. The setting also persists for subsequent breakpoints, so you only need to change it once.

like image 31
ayluo Avatar answered Sep 22 '22 12:09

ayluo