This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197727 - Maven processes are not terminated on IDE exit
Summary: Maven processes are not terminated on IDE exit
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-14 05:10 UTC by vaskar
Modified: 2011-04-15 08:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vaskar 2011-04-14 05:10:16 UTC
Steps to reproduce:

1. Create a maven project.

2. Create a dummy class with a simple main method in it:

	public static void main(String args[]) throws Exception {
		while(true) {
			System.out.println("!");
			Thread.sleep(3000);
		}
	}

3. Right-click on the class name and select "Run file". 

4. Close IDE.

5. Check the list of system processes and see that the dummy class is still running.

Expected result: the process is terminated on IDE exit. That is the case when a regular (not maven-based) project is running.
Comment 1 Jesse Glick 2011-04-14 12:25:04 UTC
Confirmed on Ubuntu/JDK 6; you are not prompted in the exit dialog to end the process when closing the IDE. A progress handle is registered but for some reason this is not being considered as a "process".
Comment 2 Jesse Glick 2011-04-14 12:30:22 UTC
Actually I was running with -J-Dnetbeans.full.hack=true which disables this dialog. When I turn that off (as it would be in a regular build), I am prompted to terminate the app. However it does not work - both the Maven process and the user app are still running.
Comment 3 Jesse Glick 2011-04-14 13:33:34 UTC
Seems that the execution engine kills ExecutorTask's when closing, but does not attempt to cancel outstanding progress handles. This easy to fix.

At the same time, for Maven external execution, ExecutorTask.stop does nothing. Seems that MavenCommandLineExecutor.run is catching ThreadDeath but in fact InterruptedException is thrown first.

A complication is that the execution engine was too hasty to kill a task forcibly even if interrupting it would work, and this seems to sometimes cause the IDE to freeze when exiting.

An annoyance is that both the ExecutorTask and the progress handle are shown in the closing dialog, but I do not know how to get around that.
Comment 4 Jesse Glick 2011-04-14 13:44:04 UTC
core-main #05699b6db55b
Comment 5 Quality Engineering 2011-04-15 08:39:58 UTC
Integrated into 'main-golden', will be available in build *201104150401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/05699b6db55b
User: Jesse Glick <jglick@netbeans.org>
Log: #197727: Maven processes are not terminated on IDE exit
1. Execution engine should cancel all (cancelable) progress handles before exiting, so they can clean up nicely.
2. Engine should also leave some time after interrupting threads for executor tasks before progressing to a hard kill.
3. Maven executor task should terminate the external process when interrupted.