Detecting "Force Quits"

What is the suggested way for us to detect (and act upon) when the IDE gets “Force Quit” from the OS ?

The recommendation probably is “don’t do this” :wink:
Why do you have to handle this inside a plugin?

There’s ShutDownTracker, but it’s internal and not always called for signals.

We track IDE freezes via this interface, but have been suspecting there are gaps:

For example:

  1. We see “UI freeze report” folders being created, but with no actual files being placed in the folder (i.e. the folder is empty)
  2. We believe that for very long freezes, it’s possible that nothing actually gets logged because the UI remains frozen until the user decides they’ve had enough and uses “Force Quit” to restart their IDE

We are looking forward to bridging these two gaps, if possible.

Is this an internal plugin? You couldn’t publish it to the Marketplace if you use @Internal IdePerformanceListener.

If the platform didn’t manage to log a freeze, I suppose it’s either not possible or a bug in the platform code. Debugging the platform code would be best instead of attempting a workaround, I think.

If it’s an internal plugin anyway, you could try to install a signal handler, e.g. using the ShutdownTracker above. adam bien's blog is related.

AFAIK you won’t be able to call anything for “SIGKILL”, which is probably was “force quit” sends.

Yes, it’s an internal plugin.

I suppose it’s either not possible or a bug in the platform code

I’m assuming the second case I talked about would be really hard to capture, but the first one seems to be something that could potentially point at a platform bug.
Have you folks ever looked into whether the “Freeze Reporter” ever generates empty folders and why?

(A bug prevents me from linking directly)
ShutDownTracker.java#L43

Any reason why I shouldn’t directly call Runtime.getRuntime().addShutdownHook myself, instead of going through ShutdownTracker ?

Which way would help me get my logging prioritized over other tasks ?

If you see issues with the builtin freeze reporting, please report them to the issue tracker (you can set visibility to jetbrains-team to make them private).

1 Like