"elasticsearch-plugin.bat remove" removes plugin descriptor file even if the plugin jar is in use #43855
Labels
:Core/Infra/Plugins
Plugin API and infrastructure
needs:reproduction
Team:Core/Infra
Meta label for core/infra team
Elasticsearch version (
bin/elasticsearch --version
): 6.2.4Plugins installed: [Any plugin]
JVM version (
java -version
): 1.8.0_212OS version (
uname -a
if on a Unix-like system): Windows Server 2012 R2Description of the problem including expected versus actual behavior:
elasticsearch-plugin.bat remove <plugin name>
performs partial deletion which leaves Elasticsearch in a bad state.Steps to reproduce:
CustomPlugin
installed in Elasticsearch. It just needs to have fileplugin-descriptor.properties
along with theCustomPlugin.jar
file in\elasticsearch\plugins\CustomPlugin
directory.bin\elasticsearch-plugin.bat remove CustomPlugin
This command fails saying that the jar file is being used. This is expected because Elasticsearch is running. But it deletes the
plugin-descriptor.properties
file.bin\elasticsearch-plugin.bat remove CustomPlugin
again.This time it fails with the following error:
The bug is that
elasticsearch-plugin.bat remove
command can leave Elasticsearch in an unexpected state. There can be two ways to fix this:plugin-descriptor.properties
file.Personally I prefer the first option as that always leaves the system in a good state.
You may ask why not stop Elasticsearch before removing the plugin. We actually do that. I will explain our scenario below:
We have automated scripts to install security updates and then upgrade our custom plugins if required. Installing security updates can sometime result in restarting the computer. After the computer restarts, we attempt to upgrade the plugin. We first check if Elasticsearch is in stopped state. We happen to pass this check sometimes because Elasticsearch service took too much time to start after computer restart. Then we go ahead and execute the
remove
command. Just before we do that, Elasticsearch service starts. And this is how we hit this bug. Of course, we can add more checks to bypass this issue but IMO, this is a bug in the plugin removal code.The text was updated successfully, but these errors were encountered: