jbossas / jboss-as-maven-plugin

Maven plugin to deploy applications to JBoss AS 7 (moved to https://github.com/wildfly/wildfly-maven-plugin)
74 stars 69 forks source link

Kill the server when the parent maven process dies during a jboss-as:run or jboss-as:start #99

Closed beirtipol closed 7 years ago

beirtipol commented 7 years ago

I'm trying to get this working in Eclipse but unfortunately when I kill the launched maven process, the child JBoss container becomes an orphaned java process. Might be worth looking at how the tomcat-maven-plugin handles this

jamezp commented 7 years ago

Interesting it should actually be getting killed. There is a shutdown hook added to ensure the server is shutdown for this plugin. That was removed in in the wildfly-maven-plugin BTW. Is it possible the maven process doesn't actually die?

beirtipol commented 7 years ago

It's possibly a glitch of running through Eclipse. Eclipse allocates a console to a maven process but does not intercept ctrl+C in the console window so you need to kill the process like any other java process started. When this happens, the child/forked jboss just falls off as an orphan .

On Mon, 30 Jan 2017, 19:06 James R. Perkins, notifications@github.com wrote:

Interesting it should actually be getting killed. There is a shutdown hook added to ensure the server is shutdown for this plugin. That was removed in in the wildfly-maven-plugin BTW. Is it possible the maven process doesn't actually die?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jbossas/jboss-as-maven-plugin/issues/99#issuecomment-276158190, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMHbFjvfv-qdcTUD3wr9on2Ry-2p9bIks5rXjTRgaJpZM4Lv_Ms .

jamezp commented 7 years ago

Hmm.. ..still kind of weird though. I would think the shutdown hook should handle killing the JBoss AS process.

beirtipol commented 7 years ago

Looks like the Run mojo adds a shutdown hook twice, once from the main 'doExecute' and again when server.start() is called. I don't think this is an issue, but more something to check.

Is it possible to 'run' server in the same process, rather than spawning off a child process in the Server.start() ??

beirtipol commented 7 years ago

FYI, the same issue happens in IntelliJ 2016.

jamezp commented 7 years ago

No the server cannot be launched in the same process. At least not in the maven plugin and I don't think we'd want to try to integrate the embedded container. Trying to get modules to work within Maven has proven to be very painful in the past.

When I get a chance I'll try to see if I can duplicate it in Intellij.

beirtipol commented 7 years ago

By the power of Greyskull, and some enormous hackery, I've written a 'kill' button for eclipse that kills all child processes of a launched process. It seems to solve our problem.

I don't think this is actually a JBoss plugin problem. It's just a side-effect of how Eclipse manages processes. Happy for you to close and ignore this one.

jamezp commented 7 years ago

haha, good to know :) Thanks!