apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.69k stars 853 forks source link

Process left open on shutdown of platform project run #4050

Open GuyDaniel opened 2 years ago

GuyDaniel commented 2 years ago

Apache NetBeans version

Apache NetBeans 13

What happened

After running/closing a newly built maven netbeans platform project in the ide, there was a process left running. The "Running Tasks" list in the status bar did not show any running tasks.

How to reproduce

Create a new Java with Maven | Netbeans Application project. Clean and build the app / branding / parent projects. Run the project. Exit the IDE - you will see a "Running Tasks" dialog appear.

Did this work correctly in an earlier version?

Apache NetBeans 12.3 or earlier

Operating System

Arch Linux 5.12.4-arch1-2

JDK

IMPLEMENTOR="Oracle Corporation" JAVA_VERSION="17" JAVA_VERSION_DATE="2021-09-14" LIBC="gnu" OS_ARCH="x86_64" OS_NAME="Linux"

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

neilcsmith-net commented 2 years ago

Can you check if you can replicate with the results shown in this thread, including whether the exclusions at the end remove the issue? https://lists.apache.org/thread/6l3tg4brq4522gcmc956jjtj855p6710

GuyDaniel commented 2 years ago

Yes, I can confirm that this is caused by running Netbeans with a JDK that is bundled with JFX. As soon as I switched to a standard JDK (Eg. Corretto JDK 11), the problem went away. I can also run a Platform project with a bundled JDK which shuts down ok. I haven't tried the switches at the end for the project yet.

neilcsmith-net commented 2 years ago

Yes, please try the exclusions at the end of that thread. Assuming you're not using them, does excluding the org.netbeans.html modules fix this for you? Just the FX one?

GuyDaniel commented 2 years ago

I applied the exclusion:

        <exclusion>
            <groupId>org.netbeans.html</groupId>
            <artifactId>net.java.html.boot.fx</artifactId>
        </exclusion>

to the org.netbeans.cluster:platform artifact, but got a failure in the build in the goal org.apache.netbeans.utilities:nbm-maven-plugin:4.3:cluster-app:

Some included modules/bundles depend on these codenamebases but they are not included. The application will fail starting up. The missing codenamebases are: net.java.html.boot.fx ref: [org.netbeans.modules.templatesui, org.netbeans.modules.htmlui]

So then I added the dependency:

        <dependency>
            <groupId>org.netbeans.external</groupId>
            <artifactId>net-java-html-boot-fx</artifactId>
            <version>RELEASE113</version>
        </dependency>

and the problem went away.

Substituting the net-java-html-boot-fx module from Release 11.3 makes things work as they should on Netbeans 14rc3.

jmborer commented 2 years ago

I noticed however that when I start an NB RCP app through Maven and try to close the IDE while the app is still running, NB believes that there are 2 processes that have been started unnamed

There is Maven and the application itself, true, but it should be considered as a single process. In the status bar, there is only one process running.

jmborer commented 2 years ago

I tried as well

    <dependency>
        <groupId>org.netbeans.cluster</groupId>
        <artifactId>platform</artifactId>
        <version>${netbeans.version}</version>
        <type>pom</type>
        <exclusions>
            <exclusion> 
                <groupId>org.netbeans.html</groupId> 
                <artifactId>net.java.html.boot.fx</artifactId> 
            </exclusion>
        </exclusions>
    </dependency>

    <dependency> 
        <groupId>org.netbeans.external</groupId> 
        <artifactId>net-java-html-boot-fx</artifactId> 
        <version>RELEASE113</version> 
    </dependency>

My app builds as well, but i still have the same issues with the number of processes detected: image

image

jmborer commented 1 year ago

I retried the same exclusions with NB 16. It seems to work. No more "running" processes.

GuyDaniel commented 1 year ago

I have just confirmed that this is still an issue with netbeans 18. To create the problem, tell your netbeans environment to use a zulu jdk bundled with jfx, create a vanilla rcp project, then run it and stop it. You will find no process in the process bar below, however when netbeans is exited you will find multiple of these things that have to be exited before the ide will exit: NB18-problem

It's still only of a small impact as the work around mentioned above with the exclusion of the new net-java-html-boot-fx still works.

mbien commented 1 year ago

Just to be clear: this is about running NB the IDE on a JDK which bundles JavaFX?

i mean. We don't test this configuration. NetBeans itself does also bundle JavaFX for some features i believe.

So it doesn't surprise me that this can cause problems. We could probably try to disable the javafx JDK modules via JVM flags and see if it makes a difference? Or just ask users to run NB on regular JDKs?

GuyDaniel commented 1 year ago

For me, this issue is about using netbeans for jfx/rcp development. Netbeans has worked on a bundled JDK/JFX in the past, and a change in netbeans broke things just after version 113.

Maybe the change that is needed is to document that this is no longer a supported configuration?

I am used to using the bundled jfx, so the next step in this for me is to re package my rcp projects to use jfx in a netbeans module, rather than having the ide run it, which is probably a better approach overall and will most likely fix the issue.

Another possibility would be to include a module which calls the jfx function Platform.exit() in the IDE on shutdown which I will play around with.