Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Maven process does not exit gracefully when terminated by Eclipse

Thanks for your input. I launch Maven using a Maven Build run configuration (which comes with m2e). Would you suggest another approach?

During the invoked Maven process, the appengine-maven-plugin will launch a Jetty server on which the application is deployed. In contrast to most other use cases, I guess, the Maven process itself keeps running and will not terminate on its own. In a Windows shell, I would send a termination signal with Ctrl+C, which causes a clean shutdown of the Jetty server and the Maven process. In Eclipse, however, the terminate button seems to instantly kill the launched process instead of allowing it to properly shut down. As a consequence, the Maven process cannot terminate any child processes before exiting, e.g., the Jetty server launched by the appengine-maven-plugin. Other people have had trouble with this lack of a possibility for proper termination in the context of similar Maven plugins that launch a dedicated server instead of merely deploying on one that is already running: http://jira.codehaus.org/browse/JETTY-208


On Thu, Mar 7, 2013 at 1:22 PM, Adrien Rivard <adrien.rivard@xxxxxxxxx> wrote:
Generally speaking when a java application is not kill with this button, it is usually two things:
- either the application is out of memory.
- either the application has some threads that refused to stop correclty, which can be considered as a bug in the application and should be fixed(at least if it happens regulary).

Either than that, are you launching with  "run as maven build " or similar command ?  In eclipse there are generally better ways to do that.
I do not know if there are some specifics to the appengine-maven-plugin but you can have a look at m2e-wtp or one of the eclipse plugin for jetty , or even a simple main that launch a jetty.
That may fix your issue at least if it is specific to "launch a jetty in a maven process".


On Thu, Mar 7, 2013 at 12:39 PM, David Geiger <geiger@xxxxxxxxxxxxxxx> wrote:
I agree that this issue is not limited to m2e. It appears to me, however, that it effects the usability of m2e on Windows quite heavily. Is this just due to my particular use case, i.e., the appengine-maven-plugin launching a Jetty process, or how do how other people deal with this? In my current setup, any Maven process launched by m2e will never terminate correctly.

According to https://bugs.eclipse.org/bugs/show_bug.cgi?id=38016 it seems that the general issue is not going to be fixed unless the Java implementation of the Process.destroy() method on Windows changes. The current 'kill' behavior might also be intended as it guarantees that even non-responding applications are terminated. In that case, the m2e developers might want to provide a dedicated way to terminate Maven gracefully.

On Wed, Mar 6, 2013 at 6:43 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
This is not specific to m2e, so I suggest bringing this up to Platform
developers and see if they can suggest anything.

--
Regards,
Igor


On 2013-03-06 12:26 PM, David Geiger wrote:
Hi,

I use m2e 1.2.0. with Eclipse 4.2.1 on a Windows 8 x64 machine to
package applications for Google AppEngine and deploy them on the local
development server using the appengine-maven-plugin.

Whenever I click on the red terminate button in the Eclipse console
view, the Maven process launched by m2e does not seem to terminate
correctly. As opposed to launching Maven from the command prompt, it
neither displays the "BUILD SUCCESS" message, nor does it terminate any
child processes such as the Jetty server launched by
appengine-maven-plugin. I need to terminate these left-over processes
manually every time I stop a Maven application from within Eclipse.

Is there another way to terminate Maven applications using m2e?

The issue seems to be related to the behavior of the terminate button in
Eclipse. Apparently, this button calls java.lang.Process.destroy(),
which, on Windows, is implemented as a simple kill and does not allow
applications to exit gracefully.

See:
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=38016
-
http://jira.codehaus.org/browse/JETTY-208?focusedCommentId=115134&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-115134

If this is a general Eclipse issue, there might be a couple of workarounds:
- There appears to be an interface ITerminate that could be implemented
(see first link, comment 31).
- Maybe the actual Maven process could be launched by another process
that is regularly checked for termination.
- An additional Eclipse button could be implemented, which correctly
terminates the Maven process.

David

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users




--
Adrien Rivard

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top