Hi,
I am recently facing intermittent issue when sequentially installing multiple custom plugins as a part of ES 5.6.10 setup. I am spawning a C# process to invoke elasticsearch-plugin.bat with plugin name as argument and this runs in a for loop for installing 6 different custom plugins.
Sample cmd process input: >> c:\elasticsearch\bin\elasticsearch-plugin.bat --install file:///c:/customplugins/mycustom-plugin1.zip
Sample output:
[2020-10-16T00:59:42] Exception in thread "main" java.nio.file.AccessDeniedException: c:\elasticsearch\plugins\.installing-4958296876653745062 -> c:\elasticsearch\plugins\mycustom-plugin2
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:301)
at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287)
at java.nio.file.Files.move(Files.java:1395)
at org.elasticsearch.plugins.InstallPluginCommand.install(InstallPluginCommand.java:587)
at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:218)
at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:202)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:69)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)
Suppressed: java.io.IOException: Could not remove the following files (in the order of attempts):
c:\elasticsearch\plugins\.installing-4958296876653745062: java.nio.file.DirectoryNotEmptyException: c:\elasticsearch\plugins\.installing-4958296876653745062
at org.apache.lucene.util.IOUtils.rm(IOUtils.java:329)
at org.elasticsearch.plugins.InstallPluginCommand.install(InstallPluginCommand.java:610)
... 8 more
I am running this parent process under admin privileges and the setup fails sporadically. I'd really appreciate some inputs on why this fails intermittently? Can the highlighted "move" part from InstallPluginCommand.java be replaced by "copy" and "delete source folder" instead to solve this problem?