quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.77k stars 2.68k forks source link

Quarkus is not gratefully being shutdown in Windows when running in DEV mode #14647

Open Sgitario opened 3 years ago

Sgitario commented 3 years ago

Describe the bug In order to reproduce the issue:

  1. Generate the Maven project using the instructions in this guide: https://quarkus.io/guides/getting-started#bootstrapping-the-project

    mvn io.quarkus:quarkus-maven-plugin:1.11.0.Final:create -DprojectGroupId=org.acme -DprojectArtifactId=getting-started -DclassName="org.acme.getting.started.GreetingResource" -Dpath="/hello"
  2. Run the project using DEV mode:

mvn clean compile quarkus:dev
  1. Exit the application using CTRL + c, and then maven would say that the build failed:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  26.859 s
[INFO] Finished at: 2021-01-27T08:59:14Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.11.0.Final:dev (default-cli) on project app-generated-skeleton: Failed to run: Dev mode process did not complete successfully -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:1.11.0.Final:dev (default-cli) on project app-generated-skeleton: Failed to run
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run

It seems that the shutdown hook is not being triggered when doing the above steps. Then, the process detects that is not alive any longer and the exit status returns 1 (error).

Note that Java is behaving differently in Linux and Windows in regards to shutdown hooks: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4485742

Expected behavior The expected behavior would be the same as running the steps in Linux.

Environment (please complete the following information):

Sgitario commented 3 years ago

^^ @stuartwdouglas

rsvoboda commented 3 years ago

Steps to reproduce using StartStopTS

Example fail: https://github.com/quarkus-qe/quarkus-startstop/pull/53/checks?check_run_id=1775459864

famod commented 3 years ago

FTR, back in October I also realized that Quarkus dev mode is not exiting gracefully on Windows: https://github.com/quarkusio/quarkus/issues/12577#issuecomment-705524706 But I have never seen such a stacktrace...

rsvoboda commented 3 years ago

This is the full stacktrace I got from StartStopTS execution on Windows as mentioned in my above comment

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.11.0.Final:dev (default-cli) on project app-generated-skeleton: Failed to run: Dev mode process did not complete successfully -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:1.11.0.Final:dev (default-cli) on project app-generated-skeleton: Failed to run
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run
    at io.quarkus.maven.DevMojo.execute (DevMojo.java:356)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Dev mode process did not complete successfully
    at io.quarkus.maven.DevMojo.execute (DevMojo.java:325)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] 
ghost commented 3 years ago

@stuartwdouglas

With 2.0.0.CR3 running in WSL I see the following behaviour: Pressing CTRL+c in Dev Mode does not exit the application when Continuous Testing is enabled. When Continuous Testing is disabled, the application stops as expected (without an exception).

stuartwdouglas commented 3 years ago

Which version of Quarkus? Is there any chance you could run mvnDebug quarkus:dev and see what happens in this bit of code: https://github.com/stuartwdouglas/quarkus/blob/96a1a527dc89872c599bc0f122b98e65f9aea6d8/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java#L404

Basically does this code detect WSL as being Windows or Linux?

ghost commented 3 years ago

@stuartwdouglas Quarkus 2.0.0.CR3 Using WSL 1 (not 2)

I don't know how to debug into the application when started in WSL. However, created a simple Java-Main class that just calls OS.determineOS() and prints the output.

It detects the OS as "Linux".

ghost commented 3 years ago

Also tested with cmd.exe:

With Continous Testing enabled:

Pressing CTRL+c only once is not enough. It has to be pressed two times.

Then the application stops with some warnings:

2021-06-28 09:20:12,051 INFO  [io.quarkus] (Quarkus Main Thread) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.0.0.CR3) started in 3.405s. Listening on: http://localhost:8080
2021-06-28 09:20:12,074 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-06-28 09:20:12,082 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy, smallrye-context-propagation]

--
Tests paused, press [r] to resumeJuni 28, 2021 9:20:37 AM org.aesh.readline.terminal.impl.AbstractWindowsTerminal$ConsoleOutput accept
WARNUNG: Failed to write out.
Juni 28, 2021 9:20:37 AM org.aesh.readline.terminal.impl.AbstractWindowsTerminal$ConsoleOutput accept
WARNUNG: Failed to write out.
Juni 28, 2021 9:20:37 AM org.aesh.readline.terminal.impl.AbstractWindowsTerminal$ConsoleOutput accept
WARNUNG: Failed to write out.
Juni 28, 2021 9:20:37 AM org.aesh.readline.terminal.impl.AbstractWindowsTerminal$ConsoleOutput accept
WARNUNG: Failed to write out.

With Continous Testing disabled:

Pressing CTRL+c once works. Application stopps with warnings:

2021-06-28 09:22:55,400 INFO  [io.quarkus] (Quarkus Main Thread) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.0.0.CR3) started in 3.410s. Listening on: http://localhost:8080
2021-06-28 09:22:55,415 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-06-28 09:22:55,423 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy, smallrye-context-propagation]
2021-06-28 09:23:04,528 INFO  [io.quarkus] (Shutdown thread) code-with-quarkus stopped in 0.027s
Juni 28, 2021 9:23:04 AM org.aesh.readline.terminal.impl.AbstractWindowsTerminal$ConsoleOutput accept
WARNUNG: Failed to write out.
Juni 28, 2021 9:23:05 AM org.aesh.readline.terminal.impl.AbstractWindowsTerminal$ConsoleOutput accept
WARNUNG: Failed to write out.
Juni 28, 2021 9:23:05 AM org.aesh.readline.terminal.impl.AbstractWindowsTerminal$ConsoleOutput accept
WARNUNG: Failed to write out.
Juni 28, 2021 9:23:05 AM org.aesh.readline.terminal.impl.AbstractWindowsTerminal$ConsoleOutput accept
WARNUNG: Failed to write out.
Batchvorgang abbrechen (J/N)?
Eat-Sleep-HitBean commented 2 years ago

Can someone tell me how to recover or ignore the problem, even restarting the computer won't solve the problem,i can not study follow the quarkus guide

Eat-Sleep-HitBean commented 2 years ago

for more information,my IDEA run quarkus:dev successfully at first,when i install Docker Desktop on Windows and restart the computer,my IDEA can not run with quarkus:dev,when i uninstall the Docker Desktop and restart computer, my IDEA run with quarkus:dev successfully again,i do not know why, but i hope my experience could help other people

stuartwdouglas commented 2 years ago

Are you using an extension that is attempting to start a dev service (https://quarkus.io/guides/dev-services)? If so docker might just be really slowly trying to start a container. There should be some log output though.

quarkus.devservices.enabled=false should disable this.

ahmedalnuaimi commented 2 years ago

I'm having the exact same problem. Disabling dev-services did not fix the problem.

alexkolson commented 1 year ago

Still witnessing this issue in 2.16.3 in windows. Any tips or updates?

This behavior manifests itself both from inside IntelliJ and from pressing "Ctrl-C" in a windows terminal console where quarkus:dev is running. It does not, however, happen every time.

It seems that, at least for me, if I switch from Windows Terminal to Powershell, sending a "Ctrl+C" somewhat reliably causes quarkus dev mode to shutdown gracefully. However, when runnung from IntelliJ, even if I use the IntelliJ "exit" option then I get a "Dev mode process did not complete successfully". Do I somehow need to get intellij to wait for the shutdown hooks to run?

I'm not really sure this is quarkus' problem per se, but reaching out here as perhaps somebody has some tips on how I can get IntelliJ to stop quarkus dev mode correctly.

NZnick commented 1 year ago

I can confirm that the same issue is occurring for me. When I runmvn compile quarkus:dev from inside Git Bash and then send Ctrl+C maven reports a BUILD FAILURE and code in my shutdown handler which @Observes ShutdownEvent never runs. However, as mentioned by @alexkolson when I try the same thing in PowerShell maven reports a BUILD SUCCESS and my shutdown handler runs. I'm running Quarkus 2.16.6.Final.

Has any progress toward fixing the cause if the problem been made?

cuichenli commented 1 year ago

I have encountered the exact same behavior on macOS, both when using the terminal and IntelliJ. I have included the @Observes ShutdownEvent annotation, but it does not seem to trigger the desired invocation. My development environment is Quarkus version 3.2.3.Final.

geoand commented 1 month ago

Is this still an issue?

thibaultmeyer commented 1 month ago

Same issue here, shutdown (and graceful shutdown) work very well in dev mode (MacOS via IntelliJ). But, dont work (juste a crash) on Windows (via IntelliJ too).

Quarkus 3.15.1 IntelliJ 2024.2.3 (Ultimate)

[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.15.1:dev (default-cli) on project quarkus-demo: Failed to run: Dev mode process did not complete successfully -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.15.1:dev (default-cli) on project quarkus-demo: Failed to run
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run
    at io.quarkus.maven.DevMojo.execute (DevMojo.java:500)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Dev mode process did not complete successfully
    at io.quarkus.maven.DevMojo.execute (DevMojo.java:467)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[DEBUG] Shutting down adapter factory; available factories [file-lock, rwlock-local, semaphore-local, noop]; available name mappers [discriminating, file-gav, file-hgav, file-static, gav, static]
[DEBUG] Shutting down 'file-lock' factory
[DEBUG] Shutting down 'rwlock-local' factory
[DEBUG] Shutting down 'semaphore-local' factory
[DEBUG] Shutting down 'noop' factory
ls-bit commented 2 weeks ago

This is also still an issue for us on Windows with Quarkus 3.15.1, ShutdownHooks and ShutdownEvents are not triggered in dev mode

thibaultmeyer commented 1 week ago

If it might help, instead of just "stopping" Maven with Ctrl-C, I try using the "q" command in the interactive Quarkus shell. Graceful shutdown works fine and no error occurs. Maybe missing something on Ctrl-C signal handling to simulate the "q" command ?

@geoand

geoand commented 6 days ago

That could be the case, but I don't have a Windows machine to check it out unfortunately