Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files still locked after earlier stopped / failed build on Windows #440

Closed
rogierhofboer opened this issue Jun 19, 2021 · 10 comments
Closed
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@rogierhofboer
Copy link

When building openHAB:

mvnd clean install -DskipTests

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on project org.openhab.core: Failed to clean project: Failed to delete C:\openhab-main\openhab-core\bundles\org.openhab.core\target\org.openhab.core-3.1.0-SNAPSHOT.jar -> [Help 1]

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on project org.openhab.core.io.http: Failed to clean project: Failed to delete C:\openhab-main\openhab-core\bundles\org.openhab.core.io.http\target\org.openhab.core.io.http-3.1.0-SNAPSHOT.jar -> [Help 1]

The target dir cannot be deleted and is still locked by java

image

killing the java process fixes the problem, could it be the mvdn does not kill all sub-processes when it is aborted and/or failing to build?

@jeffjensen
Copy link
Contributor

jeffjensen commented Jun 19, 2021

Same happens for me on my current product work (no public repo). It's also reproducible - always the same modules. One java.exe has the jars open.

@rogierhofboer
Copy link
Author

This seems to be a duplicate of / related to #115

@gnodet
Copy link
Contributor

gnodet commented Jul 9, 2021

I can't build openhab on windows for some reasons (code style issues). Can anyone try with #448 ? It removes the classloader for the bnd-maven-plugin from the cache after the build, so it should get rid of the locks hopefully.

@rogierhofboer
Copy link
Author

Thanks for looking into this. I will try it this evening.

@rogierhofboer
Copy link
Author

I need a little more time because of other priorities.
I just succeeded building your i440 branch on Windows with GraalVM / native-image.
I will try to do some extensive tests tomorrow.

@rogierhofboer
Copy link
Author

rogierhofboer commented Jul 11, 2021

Unfortunately this doesn't solve the problem.

I also have problems getting openHAB to compile on Windows and I am trying to solve them.

Make sure core.autocrlf is set:
git config --global core.autocrlf true

And skip all checks and tests (at least for now), by adding the following options (maybe not all of them are needed):
-DskipTests -DskipChecks -Dcheckstyle.skip=true -Dmaven.test.skip=true -Dspotless.check.skip=true

On openhab-core run:
mvnd clean install -DskipTests -DskipChecks -Dcheckstyle.skip=true -Dmaven.test.skip=true -Dspotless.check.skip=true

The first time it succeeds, the second time it fails:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:02 min (Wall Clock)
[INFO] Finished at: 2021-07-11T11:32:12+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on project org.openhab.core.io.http: Failed to clean project: Failed to delete C:\ha\openhab-main\git\openhab-core\bundles\org.openhab.core.io.http\target\org.openhab.core.io.http-3.2.0-SNAPSHOT.jar -> [Help 1]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on project org.openhab.core: Failed to clean project: Failed to delete C:\ha\openhab-main\git\openhab-core\bundles\org.openhab.core\target\org.openhab.core-3.2.0-SNAPSHOT.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -r

The files are locked by the java process (GraalVM now ;) )
image

Lockhunter can also be used to easily kill the java process locking the file

To be sure, the version I use checks out with your commit:

C:\ha\openhab-main\git\openhab-core>mvnd -version
mvnd native client 0.5.3-SNAPSHOT-windows-amd64 (752deb48214ccc703e2d81478c1cc46b4ac91d5c)
Terminal: org.jline.terminal.impl.jansi.win.JansiWinSysTerminal
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Program Files\mvndaemon\mvnd-0.5.2-windows-amd64\mvn
Java version: 11.0.11, vendor: GraalVM Community, runtime: C:\Program Files\GraalVM\graalvm-ce-java11-21.1.0
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

My knowledge of Maven and mvnd is not good enough (yet) to look at this myself.

@gnodet
Copy link
Contributor

gnodet commented Jul 20, 2021

@rogierhofboer could you try give a try to openhab/openhab-core#2432 ?

@rogierhofboer
Copy link
Author

@gnodet sorry for the late response. This fixes the problem for me. But shouldn't it also work with java instead of exec?

@gnodet
Copy link
Contributor

gnodet commented Jul 27, 2021

Yes, it should work with java, but the problems is not in mvnd, rather in the invoked java code, in this case, the eclipse EMF generator. So you can raise an issue on their side, but I can't do anything in mvnd if they keep references to the classloaders somehow.

@gnodet gnodet closed this as completed Jul 27, 2021
@rogierhofboer
Copy link
Author

ok thanks for your help fixing this.

gnodet added a commit to gnodet/mvnd that referenced this issue Jul 29, 2021
gnodet added a commit to gnodet/mvnd that referenced this issue Sep 2, 2021
gnodet added a commit that referenced this issue Sep 2, 2021
@ppalaga ppalaga added this to the No fix/wont't fix milestone Oct 26, 2021
@gnodet gnodet added the wontfix This will not be worked on label Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants