How do you shutdown a debug session gracefully

Hi, isn't there a way to gracefully shutdown a debug session instead of just
terminating the session?

Thanks,
Ashwin.

10 comments
Comment actions Permalink

Hello Ashwin,

What do you mean under "gracefully"?

Regards,
Kirill

0
Comment actions Permalink

The red stop button just terminates the JVM in Debug mode. In Run mode, you can also send a Ctrl-C signal to shutdown the program, correct?

0
Comment actions Permalink

The only definition of "graceful" I can think of is the program executing its own shut-down logic, concluding it a call to System.exit(). I can't see a way to endow the debugger with the ability to magically be able to trigger that processing.


Randall Schulz

0
Comment actions Permalink

Hello Ashwin,

AFAIK there's no reliable way in Java to send SIGINT termination signal to other process, so IDEA invokes Process.destroy() for an "ungraceful" shutdown. I may imagine that particular application can read input stream and handle a certain sequence as a 'shutdown' command, but it won't work in general case.

Regards,
Kirill

0
Comment actions Permalink

SIGTERM would be the conventional "polite" way to terminate a process from without. SIGKILL is the "insistent" way.

Additionally, many interactive applications don't even quit when they receive a SIGINT (conventionally generated by the terminal driver), but rather go back to some sort of top-level prompt, stop a long-running computation, or perforam a similar non-termination activity.


Randall Schulz

0
Comment actions Permalink

Are there updates here?

0
Comment actions Permalink

@Pavel could you please describe your issue? What run configuration do you use?

0
Comment actions Permalink

Actually, I do not modify the default preset:

0
Comment actions Permalink

Such a code works well and allows me to handle shutdown gracefully but not in a debug session.

quit := make(chan os.Signal, 1)
signal.Notify(quit, os.Interrupt)
<-quit
0
Comment actions Permalink

Pavel Prischepa You can follow the update of the GO-8084 task. I recommend to go and vote to stay informed.

0

Please sign in to leave a comment.