grails-core icon indicating copy to clipboard operation
grails-core copied to clipboard

Fix stop-app in grails cli

Open codeconsole opened this issue 1 year ago • 4 comments

https://github.com/grails-profiles/base/blob/7.0.x/commands/stop-app.groovy

codeconsole avatar Sep 26 '24 23:09 codeconsole

https://github.com/grails-profiles/base/issues/31

codeconsole avatar Sep 26 '24 23:09 codeconsole

management-agent.jar was removed after java 1.8 and this code should be removed/refactored

https://github.com/grails-profiles/base/blob/6294515794b8ac8ae4eeb6a3da7ff40e5f132bb8/commands/stop-app.groovy#L31

codeconsole avatar Sep 26 '24 23:09 codeconsole

https://github.com/grails-profiles/base/blob/6294515794b8ac8ae4eeb6a3da7ff40e5f132bb8/commands/stop-app.groovy#L76-L98

Perhaps there is a better way to stop the app similar to how quit works https://github.com/grails/grails-core/blob/ab9fdf3921f6a04f355d3b8282b9b29d16b98dab/grails-shell/src/main/groovy/org/grails/cli/GrailsCli.groovy#L665-L672

codeconsole avatar Sep 26 '24 23:09 codeconsole

I think this is the same bug.
java=21.0.8-zulu gradle=8.14.3 groovy=4.0.28 grails=7.0.0-RC1

How to reproduce: Create a new app. Start your app with grails> run-app then try to stop it grails> stop-app --stacktrace will output java.io.FileNotFoundException: http://localhost:8080/actuator/shutdown at stop-app.run(stop-app.groovy:87) at org.grails.cli.profile.commands.script.GroovyScriptCommand.handle(GroovyScriptCommand.groovy:156) at org.grails.cli.profile.AbstractProfile.handleCommand(AbstractProfile.groovy:478) at org.grails.cli.GrailsCli.handleCommand(GrailsCli.groovy:364) at org.grails.cli.GrailsCli$_handleCommandWithCancellationSupport_closure6.doCall(GrailsCli.groovy:455) <===========--> 90% EXECUTING [2m 45s]mandWithCancellationSupport_closure6.call(GrailsCli.groovy) | Error Application not running.

It says application is not running. But it is actually running. Now if you exit grails> with control-c then it will kill the app.

arjangch avatar Sep 14 '25 00:09 arjangch