Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does intellij idea not kill the debug process immediately?

I'm using idea 2016.1.1 and wonder why idea does not kill the debug process immediately when I click the stop button.

E.g. use this piece of code to reproduce it

public class Main {

  public static void main(String[] args) {
    int i = 0;
    while (true) {
      i++;
      System.out.print("I'm still alive: ");
      System.out.println(i);
    }
  }
}

Set a breakpoint before the loop begins.

enter image description here

Start a debugging session, wait until it breaks and press the red stop button (CTRL-F2).

enter image description here

I would expect that the process is stopped immediately and that it does not print anything, but it prints:

"C:\Program Files\Java\jdk1.6.0_38\bin\java" ....
Connected to the target VM, address: '127.0.0.1:54394', transport: 'socket'
Disconnected from the target VM, address: '127.0.0.1:54394', transport: 'socket'
I'm still alive: 1
I'm still alive: 2
I'm still alive: 3
I'm still alive: 4
...
I'm still alive: 319
I'm still alive: 320
I'm still alive: 321
I'm still alive: 
Process finished with exit code -1

Why is the process not stopped immediately?

Is there another way to force an immediately stop?

EDIT

Just tried it with idea 14.1.5. The process stops immediately as expected. It seems that a bug was introduced with 2016.

like image 308
René Link Avatar asked Apr 20 '16 13:04

René Link


People also ask

How to kill Debugger in IntelliJ?

Terminate a debugger sessionClick the Stop button in the Debug tool window. Alternatively, press Ctrl+F2 and select the process to terminate (if there are two or more of them).

How do I stop IntelliJ server running on port 8080?

To stop a process, you can use ⌘F2 on macOS, or Ctrl+F2 on Windows/Linux.

How do I change the debugging port in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Debugger. In the Built-in server area, specify the port where the built-in web server runs. By default this port is set to the default IntelliJ IDEA port 63342 through which IntelliJ IDEA accepts connections from services.

Which of the following inbuilt Java debuggers is supported by IntelliJ idea?

Java Prime Pack IntelliJ provides inbuilt Java debugger.


2 Answers

When press Stop during a debugging session,
The default behavior of IntelliJ Idea is not to kill the process immediately!.

But if you need to change this behavior to kill the debugging process immediately
Which I think that, should be the default behavior :)

You can activate it via the Settings:
Settings > Build, Execution, Development > Debugger >

enter image description here

like image 148
ahmednabil88 Avatar answered Sep 21 '22 08:09

ahmednabil88


The bug IDEA-155007 is fixed in 2016.3 (163.7743.44). I've just verified it.

like image 23
René Link Avatar answered Sep 21 '22 08:09

René Link