devonfw / IDEasy

Tool to automate the setup and updates of a development environment for any project (Successor of devonfw-ide).
Apache License 2.0
13 stars 24 forks source link

Still windows file locking problems #594

Open hohwille opened 2 months ago

hohwille commented 2 months ago

We have closed #264 and have solved major Windows file locking issues. With some advanced testing I could force a situation where IDEasy still runs into errors with Windows file locking:

$ ide install mvn 4.0.0-beta-3
Variable IDE_ROOT is set to 'D:\projects\_ide' but for your project 'IDEasy' the path 'D:\projects' would have been expected.
MVN_VERSION=4.0.0-beta-3 has been set in SETTINGS@D:\projects\IDEasy\settings\ide.properties
Start: Install mvn
Deleting corrupted installation at D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3
Step 'ide (install,mvn,4.0.0-beta-3)' failed: java.lang.IllegalStateException: Failed to delete D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3
 Step 'Install mvn (4.0.0-beta-3)' failed: java.lang.IllegalStateException: Failed to delete D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3
2 step(s) failed out of 3 steps.
An unexpected error occurred!
We are sorry for the inconvenience.
Please check the error below, resolve it and try again.
If the error is not on your end (network connectivity, lack of permissions, etc.) please file a bug:
https://github.com/devonfw/ide/issues/new?assignees=&labels=bug&projects=&template=bug.md&title=IllegalStateException%3A+Failed+to+delete+D%3A%5Cprojects%5C_ide%5Csoftware%5Cdefault%5Cmvn%5Cmvn%5C4.0.0-beta-3
java.lang.IllegalStateException: Failed to delete D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3
        at com.devonfw.tools.ide.io.FileAccessImpl.delete(FileAccessImpl.java:752)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:219)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:177)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:151)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.doInstall(LocalToolCommandlet.java:78)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.doInstall(LocalToolCommandlet.java:65)
        at com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet.doInstall(PluginBasedCommandlet.java:145)
        at com.devonfw.tools.ide.tool.ToolCommandlet.install(ToolCommandlet.java:226)
        at com.devonfw.tools.ide.tool.mvn.Mvn.install(Mvn.java:72)
        at com.devonfw.tools.ide.commandlet.InstallCommandlet.run(InstallCommandlet.java:49)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:867)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:779)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:89)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:52)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:29)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.nio.file.FileSystemException: D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3\boot\plexus-classworlds-2.8.0.jar: The process cannot access the file because it is being used by another process
        at java.base@21.0.2/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:273)
        at java.base@21.0.2/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:104)
        at java.base@21.0.2/java.nio.file.Files.delete(Files.java:1152)
        at com.devonfw.tools.ide.io.FileAccessImpl.deleteRecursive(FileAccessImpl.java:768)
        at com.devonfw.tools.ide.io.FileAccessImpl.deleteRecursive(FileAccessImpl.java:763)
        at com.devonfw.tools.ide.io.FileAccessImpl.deleteRecursive(FileAccessImpl.java:763)
        at com.devonfw.tools.ide.io.FileAccessImpl.delete(FileAccessImpl.java:749)
        ... 15 more

Error: IDEasy failed with exit code 255

Besides I am not yet clear why IDEasy came to this conclusion:

Deleting corrupted installation at D:\projects_ide\software\default\mvn\mvn\4.0.0-beta-3

What makes such installation to be considered as corrupted? How did I manage to reach this state or how could someone reproduce this?

hohwille commented 2 months ago

I got the same error now with Eclipse:

$ ide -t install eclipse
Looking for IDE_HOME in D:\projects\demo9
...
Start: Install eclipse
...
Resolved version pattern * to version 2024-09
Deleting corrupted installation at D:\projects\_ide\software\default\eclipse\eclipse\2024-09
Deleting D:\projects\_ide\software\default\eclipse\eclipse\2024-09 ...
Deleting D:\projects\_ide\software\default\eclipse\eclipse\2024-09\plugins\ch.qos.logback.classic_1.5.7.jar ...
Step 'Install eclipse' ended with failure.
Step 'ide' ended with failure.
ide (install,eclipse) failed after PT0.859S
 Install java (8u412b08) succeeded after PT0.001S 0.11641443538998836% of total
 Install eclipse (*) failed after PT0.602S 70.081490104773% of total

Step 'ide (install,eclipse)' failed: java.lang.IllegalStateException: Failed to delete D:\projects\_ide\software\default\eclipse\eclipse\2024-09
 Step 'Install eclipse (*)' failed: java.lang.IllegalStateException: Failed to delete D:\projects\_ide\software\default\eclipse\eclipse\2024-09
2 step(s) failed out of 3 steps.
An unexpected error occurred!
We are sorry for the inconvenience.
Please check the error below, resolve it and try again.
If the error is not on your end (network connectivity, lack of permissions, etc.) please file a bug:
https://github.com/devonfw/IDEasy/issues/new?assignees=&labels=bug&projects=&template=bug.md&title=IllegalStateException%3A+Failed+to+delete+D%3A%5Cprojects%5C_ide%5Csoftware%5Cdefault%5Ceclipse%5Ceclipse%5C2024-09
java.lang.IllegalStateException: Failed to delete D:\projects\_ide\software\default\eclipse\eclipse\2024-09
        at com.devonfw.tools.ide.io.FileAccessImpl.delete(FileAccessImpl.java:802)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:205)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:163)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:148)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.install(LocalToolCommandlet.java:84)
        at com.devonfw.tools.ide.tool.ToolCommandlet.install(ToolCommandlet.java:223)
        at com.devonfw.tools.ide.commandlet.InstallCommandlet.run(InstallCommandlet.java:55)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:860)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:769)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:89)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:52)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:29)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.nio.file.FileSystemException: D:\projects\_ide\software\default\eclipse\eclipse\2024-09\plugins\ch.qos.logback.classic_1.5.7.jar: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird
        at java.base@21.0.2/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:273)
        at java.base@21.0.2/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:104)
        at java.base@21.0.2/java.nio.file.Files.delete(Files.java:1152)
        at com.devonfw.tools.ide.io.FileAccessImpl.deleteRecursive(FileAccessImpl.java:818)
        at com.devonfw.tools.ide.io.FileAccessImpl.deleteRecursive(FileAccessImpl.java:813)
        at com.devonfw.tools.ide.io.FileAccessImpl.deleteRecursive(FileAccessImpl.java:813)
        at com.devonfw.tools.ide.io.FileAccessImpl.delete(FileAccessImpl.java:799)
        ... 12 more

Error: IDEasy failed with exit code 255