IntelliJ debugger gets stuck

后端 未结 5 792
死守一世寂寞
死守一世寂寞 2021-02-02 07:38

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 \"C

相关标签:
5条回答
  • 2021-02-02 08:12

    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.

    0 讨论(0)
  • 2021-02-02 08:15

    In most cases, it would be because of the watches that you add while debugging. Clear the watch statements that would result in recursive execution of same statements as in the code. Always keep the watches clean before debugging.

    0 讨论(0)
  • 2021-02-02 08:17

    The fix that worked for me was to remove method breakpoints. That made it superfast.

    0 讨论(0)
  • 2021-02-02 08:25

    I just ran into what looks like the same issue. In my case it was a class (KafkaStream) in the breakpoint stack trace with a "bad" toString method. The toString method blocks and therefore hangs the debugger. I tested the toString method in the main line code and it hung the main thread (i.e. this is not a debugger specific issue).

    Here is the stack trace for my thread that hit the breakpoint (on a line that was just trying to test a boolean attribute of my class):

    Hung Breakpoint Stacktrace

    Intellij provides a way to work around for my issue. It allows you to override how the debugger renders the class:

    Work Around

    If your issue comes back I suggest taking a thread dump (inside or outside of the IDE) and see what your thread is doing.

    0 讨论(0)
  • 2021-02-02 08:33

    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.

    0 讨论(0)
提交回复
热议问题