# Multiple Plugin Installations on Windows intermittently fail with java.nio.AccessDeniedException

**URL:** <https://discuss.elastic.co/t/multiple-plugin-installations-on-windows-intermittently-fail-with-java-nio-accessdeniedexception/253630>\
**Category:** Elasticsearch\
**Created:** [October 29, 2020, 1:55am UTC](https://discuss.elastic.co/t/multiple-plugin-installations-on-windows-intermittently-fail-with-java-nio-accessdeniedexception/253630 "2020-10-29T01:55:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Varsha\_Muzumdar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varsha_muzumdar/32/77741_2.png) [@Varsha\_Muzumdar](https://discuss.elastic.co/u/Varsha_Muzumdar)\
**Post date:** [October 29, 2020, 1:55am UTC](https://discuss.elastic.co/t/multiple-plugin-installations-on-windows-intermittently-fail-with-java-nio-accessdeniedexception/253630/1 "2020-10-29T01:55:11Z")

</div>

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](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process?view=netcore-3.1) 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:

```auto
[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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 26, 2020, 1:55am UTC](https://discuss.elastic.co/t/multiple-plugin-installations-on-windows-intermittently-fail-with-java-nio-accessdeniedexception/253630/2 "2020-11-26T01:55:48Z")

</div>

Closed on November 26, 2020, 1:55am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
