When right clicking a spring boot application (main class) and selecting runas-> java application, the application starts.
However when clicking the red square the process is hard killed and the shutdown hooks, do not appear to be called. I mostly use IntelliJ but our STS users are running into this. Things like embedded redis (used a lot by our Windows users) have lots of running processes accumulating over time because of this.
Note this is not a problem if you ctrl-c to stop the application from a terminal.
Seems somewhat related to a problem I ran into a while back with tc-server, if you think this ticket belongs with STS I can move it there. https://issuetracker.springsource.com/browse/STS-3396
Comment From: philwebb
There's a long thread about this on the bugs.eclipse.org. From what I can tell it seems to be a limitation of the way that Java starts processes.
For 1.3 we recently added a JMX bean that Maven can use to shutdown the app (#2525). Perhaps this is something that the IDEs could also use. I'm also happy to add any other additional hooks but I don't think we can do much without feedback from the IDE developers.
Comment From: philwebb
/cc @snicoll @kdvolder @aclement
Comment From: snicoll
Yes, using the Admin MBean sounds like a good idea to me. @kdvolder @aclement I am happy to help if you have any question.
Comment From: kdvolder
We can use that MBean, actually already using it to detect whether an app is 'starting' or 'ready' for the new Boot App Dashboard (experimental feature not yet part of STS proper).
The MBean only works for Boot 1.3 and later, correct? So I gather this isn't something terribly urgent to support as 1.3 isn't even out yet.
We will also need a fallback for older versions of boot, or for cases where user mess around with the launch config and manage to (deliberately or accidentally) disable the MBean by setting system properties, or disabling JMX.
We'll need to find a way to replace Eclipse's 'process' implementation with our own to be able to change how processes are terminated by Eclipse, but I think this is feasible. I looked into this recently, ironically to try and solve the 'opposite' problem on Linux: on Linux sometimes boot processes 'resist termination' because shutdown hooks are getting executed but are getting stuck for a long time (several minutes)... apparantly because "Tomcat needs entropy". Problems like these may be exacerbated by using life cycle management.
All in all, it seems that people will probably prefer 'clean' shutdown over 'reliable/fast' shutdown?
Kris
On Wed, Jun 17, 2015 at 1:13 AM, Stéphane Nicoll notifications@github.com wrote:
Yes, using the Admin MBean sounds like a good idea to me. @kdvolder https://github.com/kdvolder @aclement https://github.com/aclement I am happy to help if you have any question.
— Reply to this email directly or view it on GitHub https://github.com/spring-projects/spring-boot/issues/3253#issuecomment-112710938 .
Comment From: kdvolder
Created STS issue: https://issuetracker.springsource.com/browse/STS-4151
Comment From: philwebb
Thanks, closing this one for now in favor of the STS issue.
Comment From: usernameAshu
Hi Folks, quite a long time here there's no recent updates regarding this issue. Is the https://issuetracker.springsource.com/browse/STS-4151 issue resolved ? Since in the STS i am using, the Terminate option still kills the app forcibly without cleaning. But the Boot dashboard termination does a clean exit. Only thing i avoid running the app from Boot dashboard is because it slows down the IDE a lot. Is there a possibility 'clean exit' can also be introduced to 'Terminate' button ?