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 232322 - Netbeans 7.3.1 instantiating another JVM for multi-threaded application
Summary: Netbeans 7.3.1 instantiating another JVM for multi-threaded application
Status: RESOLVED DUPLICATE of bug 253517
Alias: None
Product: platform
Classification: Unclassified
Component: Execution (show other bugs)
Version: 7.4
Hardware: All Mac OS X
: P3 normal with 4 votes (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-06 10:28 UTC by cmrp
Modified: 2015-11-09 10:13 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
-verbose (439.02 KB, text/plain)
2013-07-10 08:47 UTC, cmrp
Details
Netbeans 7.3.1 maven scheduledTask project test file (8.36 KB, application/zip)
2013-07-10 10:43 UTC, cmrp
Details
sample project demonstrating the issue (1.94 KB, application/zip)
2014-03-19 17:35 UTC, .wojtek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cmrp 2013-07-06 10:28:28 UTC
I've got a Spring3.2.3 based Java executable application. The application also instantiates a spring ScheduleTask. I recently updated my Netbeans to 7.3.1 version and every time I run my application netbeans seems to initiate another JVM instance to run the scheduledTask and stopping the application via the Output tab seems to stop the only the main application but the ScheduleTask seems to be running. So to stop the ScheduleTask I had to manually kill the process. 

To confirm this is a Netbeans 7.3.1 issue I switched batch to 7.2.1, and 7.2.1 did not instantiate another JVM.
Comment 1 Tomas Zezula 2013-07-09 13:50:49 UTC
NetBeans does not care about Spring ScheduleTask at.
The IDE starts the application in a new JVM instance with cmd line arguments given in project.properties.
The actual command line is visible when you run the application with ant verbose (debug).
Please attach the ant verbose output (Tools/Options/Java/Ant/Verbosity Level).
Thanks!
Comment 2 Tomas Zezula 2013-07-09 13:51:34 UTC
On Mac NetBeans/Preferences//Java/Ant/Verbosity Level
Comment 3 cmrp 2013-07-10 07:25:53 UTC
The verbose setting does not seem to be working on Netbeans 7.3.1 but is working on Netbeans 7.2.1 on Mac.  
I thought maybe there's a problem with my installation. So I delete Netbeans 7.3.1  application file from my Applications folder and deleted the following folders
 
library/application support/netbeans/7.3.1
library/caches/netbeans/7.3.1

installed 7.3.1 again and when netbeans asked to import setting from the older version I selected 'No' this time. 

Ran my project again and the same problem exists, Netbeans seems to be starting a new Java instance for scheduling and Verbose flag is not working either. But verbose works for 7.2.1. What could be the problem ? 

I'm using Mac snow leopard 10.6.8
Comment 4 cmrp 2013-07-10 07:35:47 UTC
It's a maven project.
Comment 5 Tomas Zezula 2013-07-10 07:51:31 UTC
>It's a maven project.
The Ant verbose works just with Ant project.
The execution for Maven project is done by mvm.
Comment 6 cmrp 2013-07-10 08:47:24 UTC
Created attachment 136925 [details]
-verbose

attached verbose.txt is the initial output of -verbose flag
Comment 7 Milos Kleint 2013-07-10 09:47:09 UTC
(In reply to comment #0)
> To confirm this is a Netbeans 7.3.1 issue I switched batch to 7.2.1, and 7.2.1
> did not instantiate another JVM.

that is because in 7.2 Compile on save is on by default, while in 7.3 it's off by default. The difference means that in 7.2 Run action is often (not always) performed by Ant (via the JavaRunner API) not maven. With Compile on save off, it's always run via maven. Please note that in upcoming 7.4, Maven is always used for execution no matter what CoS setting is set for the project.

Ant build doesn't spawn a new java.lang.Process while Maven execution does.

When performing cancel we use the ExternalProcessSupport.destroy() which should either use Process.destroy() to kill or some additional nb.org implementation that would attempt to kill all subprocesses that inherited the environment from the maven build jvm. So either there is something wrong with the algorithm or the spawned jvm doesn't inherit the environment and is missing the marker env var used to identify processes to kill.

reassigning for evaluation. Please note that a sample project demonstrating the problem would help.
Comment 8 cmrp 2013-07-10 10:43:58 UTC
Created attachment 136937 [details]
Netbeans 7.3.1 maven scheduledTask project test file

I've attached a test project. If you run the Main.java class and check your processes in Activity Monitor on Mac you can see it starts two Java instances and when I hit click stop button in the Output tab in Netbeans the 2nd java instance is still running.
Comment 9 .wojtek 2014-03-19 17:35:37 UTC
Created attachment 146157 [details]
sample project demonstrating the issue

The problem was present for NetBeans 7.3.1, 7.4 and is still present in NetBeans 8.0. It wasn't that problematic with jdk7 because there was another dock item allowing easily killing the running java process but with jdk8 there is no additional item hence need for looking for process id and killing it manually because "stop" button doesn't work and leaves running JVM.

Here is attached simple Maven process to illustrate. Unpack, open in NetBeans, Run it (either whole project or just the file), use the stop button to end it.

Console output:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cd /Users/wojtek/dev/tmps/NoStop; JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.app/Contents/Resources/NetBeans/java/maven/bin/mvn" "-Dexec.args=-classpath %classpath nostop.NoStop" -Dexec.executable=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -Dexec.classpathScope=runtime -DskipTests=true org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...
                                                                        
------------------------------------------------------------------------
Building NoStop 1.0-SNAPSHOT
------------------------------------------------------------------------

--- exec-maven-plugin:1.2.1:exec (default-cli) @ NoStop ---

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Observation - after starting the process I can see "Launcher" in running java processes:
wojtek@atlantiscity ~/dev/tigase $ jps
2358 Launcher
2361 NoStop
2362 Jps
1915 Main

After stopping the application from NetBeans only the launcher process stopps:
wojtek@atlantiscity ~/dev/tigase $ jps
2361 NoStop
1915 Main
2363 Jps
Comment 10 Petr Hejl 2014-07-18 14:50:57 UTC
Seems to be duplicate of issue #245474.

*** This bug has been marked as a duplicate of bug 245474 ***
Comment 11 .wojtek 2015-09-08 05:29:50 UTC
I've tried latest Beta available on main netbeans page and the issue still persists - as per #245474 - using maven-exec to run application (which is default method in NB) causes running new process (actual application) and upon stopping the execution from the IDE mave-exec is killed but the new process persists.
Comment 12 .wojtek 2015-09-08 05:33:26 UTC
Interestingly - it works when the project is run with "Debug" instead of "Run"
Comment 13 Petr Hejl 2015-09-14 09:36:24 UTC

*** This bug has been marked as a duplicate of bug 253517 ***
Comment 14 .wojtek 2015-11-09 10:13:26 UTC
This issue is not resolved. The new issue is, well... newer than this one so why this one is marked as the duplicate?!

This issue is still present it recently released 8.1.