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

Provide more actionable error message when installing an offline plugin in the plugins directory #27401

Open
jasontedor opened this issue Nov 15, 2017 · 7 comments
Assignees
Labels
:Core/Infra/Plugins Plugin API and infrastructure >enhancement good first issue low hanging fruit Team:Core/Infra Meta label for core/infra team

Comments

@jasontedor
Copy link
Member

Today if you try to install a plugin from a distribution that sits inside the plugins directory, you get a non-actionable error message:

Exception in thread "main" java.lang.IllegalStateException: Could not load plugin descriptor for existing plugin [x-pack-5.6.3.zip]. Was the plugin built before 2.0?
	at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:334)
	at org.elasticsearch.plugins.InstallPluginCommand.jarHellCheck(InstallPluginCommand.java:545)
	at org.elasticsearch.plugins.InstallPluginCommand.verify(InstallPluginCommand.java:527)
	at org.elasticsearch.plugins.InstallPluginCommand.install(InstallPluginCommand.java:570)
	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)

This is deliberate, we do not want anything in the plugins directory that is not a plugin, but we could provide a more actionable error message here. This behavior will be documented clearly after #27400 so this is low-priority.

@jasontedor jasontedor added the :Core/Infra/Core Core issues without another label label Nov 15, 2017
@rjernst rjernst added the help wanted adoptme label Nov 15, 2017
@jasontedor jasontedor removed the help wanted adoptme label Jan 17, 2018
@jasontedor jasontedor added :Core/Infra/Plugins Plugin API and infrastructure and removed :Core/Infra/Core Core issues without another label labels Mar 14, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

mayya-sharipova added a commit to mayya-sharipova/elasticsearch that referenced this issue Mar 14, 2018
Provide more actionable error message when installing an offline plugin
in the plugins directory, and the `plugins` directory for the node
contains plugin distribution.

Closes elastic#27401
mayya-sharipova added a commit that referenced this issue Mar 14, 2018
Provide more actionable error message when installing an offline plugin
in the plugins directory, and the `plugins` directory for the node
contains plugin distribution.

Closes #27401
mayya-sharipova added a commit that referenced this issue Mar 14, 2018
Provide more actionable error message when installing an offline plugin
in the plugins directory, and the `plugins` directory for the node
contains plugin distribution.

Closes #27401
@mayya-sharipova
Copy link
Contributor

mayya-sharipova commented Mar 15, 2018

We have reverted the commit for this PR, as Windows tests were failing: https://internal-ci.elastic.co/job/elastic+x-pack-elasticsearch+master+multijob-windows-compatibility/1536/console

15:11:45 Starting process 'command 'cmd''. Working directory: C:\Users\jenkins\workspace\elastic+x-pack-elasticsearch+master+multijob-windows-compatibility\elasticsearch-extra\x-pack-elasticsearch\docs\build\cluster\integTestCluster node0\cwd Command: cmd /C call C:\Users\jenkins\WORKSP~1\ELASTI~3\ELASTI~1\X-PACK~1\docs\build\cluster\INTEGT~1\ELASTI~1.0-A\bin\elasticsearch-plugin install file:/C:/Users/jenkins/workspace/elastic+x-pack-elasticsearch+master+multijob-windows-compatibility/elasticsearch-extra/x-pack-elasticsearch/docs/build/cluster/integTestCluster%20node0/plugins%20tmp/x-pack-7.0.0-alpha1-SNAPSHOT.zip
15:11:45 Successfully started process 'command 'cmd''
15:11:47 -> Downloading file:/C:/Users/jenkins/workspace/elastic x-pack-elasticsearch master multijob-windows-compatibility/elasticsearch-extra/x-pack-elasticsearch/docs/build/cluster/integTestCluster node0/plugins tmp/x-pack-7.0.0-alpha1-SNAPSHOT.zip
15:11:47 Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Users/jenkins/workspace/elastic+x-pack-elasticsearch+master+multijob-windows-compatibility/elasticsearch-extra/x-pack-elasticsearch/docs/build/cluster/integTestCluster%20node0/plugins%20tmp/x-pack-7.0.0-alpha1-SNAPSHOT.zip
15:11:47 	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
15:11:47 	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
15:11:47 	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
15:11:47 	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
15:11:47 	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
15:11:47 	at java.base/java.nio.file.Paths.get(Paths.java:84)
15:11:47 	at org.elasticsearch.plugins.InstallPluginCommand.downloadZip(InstallPluginCommand.java:332)
15:11:47 	at org.elasticsearch.plugins.InstallPluginCommand.download(InstallPluginCommand.java:254)
15:11:47 	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:222)
15:11:47 	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:213)
15:11:47 	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
15:11:47 	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
15:11:47 	at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:75)
15:11:47 	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
15:11:47 	at org.elasticsearch.cli.Command.main(Command.java:90)
15:11:47 	at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:48)
15:11:47 :x-pack-elasticsearch:docs:integTestCluster#installPluginPlugin FAILED
15:11:47 :x-pack-elasticsearch:docs:integTestCluster#installPluginPlugin (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 1.191 secs.

Citing Jason Tedor here:

we should step back and slowly try to fix the issue without builds for an entire OS failing over and over; ...the other problem that i see here is a suppress forbidden on the method that you changed yesterday which let Paths#get slipped in unnoticed; this is not your fault, but this is why i prefer that when we suppressed forbidden it’s tightly scoped (like move the forbidden invocation to its own method and suppress there and never add code to that other method) ... we suppress there for getInputStream which means adding any other forbidden API will now go unnoticed.. i wish suppress forbidden could be applied to a statement only, this to me is its biggest downside

So, we need another approach for this task.

@jasontedor
Copy link
Member Author

@mayya-sharipova Is there anything that I can do to help on this one?

@rjernst rjernst added the Team:Core/Infra Meta label for core/infra team label May 4, 2020
@rjernst rjernst added the needs:triage Requires assignment of a team area label label Dec 3, 2020
@williamrandolph
Copy link
Contributor

This still reproduces. From a 7.6.2 build:

cd plugins/
curl -O https://artifacts.elastic.co/downloads/elasticsearch-plugins/discovery-ec2/discovery-ec2-7.6.2.zip
cd ..
bin/elasticsearch-plugin install file:///Users/wbrafford/work/es-builds/7.6.2/elasticsearch-7.6.2/plugins/discovery-ec2-7.6.2.zip

I don't think it would be too hard to fix this.

@williamrandolph williamrandolph added good first issue low hanging fruit and removed needs:triage Requires assignment of a team area label labels Dec 18, 2020
@interpreter95
Copy link

Hi @mayya-sharipova ,

Are you still working on this issue?
Otherwise, I'd like to try my hands on it 😃

@ghost
Copy link

ghost commented Jun 29, 2021

I would like to help with this issue, but I'm unable to reproduce it.

I tried building version 7.6.2, mentioned by @williamrandolph, but the "./gradlew localDistro" throws an error. I also tried building the most recent version, but I couldn't find the executable called elasticsearch-plugins, which is the one I would use to reproduce the specific issue and check if the changes I made locally fixed it.

Can you help me?

@ChrisHegarty
Copy link
Contributor

ChrisHegarty commented Sep 8, 2021

As of time of writing, with version 8, here is the latest error message when trying to install a plugin from a zip in the plugins directory.

e.g.

/elasticsearch-8.0.0-SNAPSHOT/bin/elasticsearch-plugin install  file:///Users/chegar/git/elasticsearch/distribution/archives/darwin-aarch64-tar/build/install/elasticsearch-8.0.0-SNAPSHOT/plugins/discovery-ec2-7.6.2.zip 
-> Installing file:///Users/chegar/git/elasticsearch/distribution/archives/darwin-aarch64-tar/build/install/elasticsearch-8.0.0-SNAPSHOT/plugins/discovery-ec2-7.6.2.zip
-> Downloading file:///Users/chegar/git/elasticsearch/distribution/archives/darwin-aarch64-tar/build/install/elasticsearch-8.0.0-SNAPSHOT/plugins/discovery-ec2-7.6.2.zip
[=================================================] 100%   
-> Failed installing file:///Users/chegar/git/elasticsearch/distribution/archives/darwin-aarch64-tar/build/install/elasticsearch-8.0.0-SNAPSHOT/plugins/discovery-ec2-7.6.2.zip
-> Rolling back file:///Users/chegar/git/elasticsearch/distribution/archives/darwin-aarch64-tar/build/install/elasticsearch-8.0.0-SNAPSHOT/plugins/discovery-ec2-7.6.2.zip
-> Rolled back file:///Users/chegar/git/elasticsearch/distribution/archives/darwin-aarch64-tar/build/install/elasticsearch-8.0.0-SNAPSHOT/plugins/discovery-ec2-7.6.2.zip
Exception in thread "main" java.lang.IllegalStateException: Could not load plugin descriptor for plugin directory [discovery-ec2-7.6.2.zip]
	at org.elasticsearch.plugins.PluginsService.readPluginBundle(PluginsService.java:392)
	at org.elasticsearch.plugins.PluginsService.findBundles(PluginsService.java:366)
	at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:359)
	at org.elasticsearch.plugins.InstallPluginAction.jarHellCheck(InstallPluginAction.java:812)
	at org.elasticsearch.plugins.InstallPluginAction.loadPluginInfo(InstallPluginAction.java:787)
	at org.elasticsearch.plugins.InstallPluginAction.installPlugin(InstallPluginAction.java:833)
	at org.elasticsearch.plugins.InstallPluginAction.execute(InstallPluginAction.java:216)
	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:84)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:114)
	at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:114)
	at org.elasticsearch.cli.Command.main(Command.java:79)
	at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:36)
Caused by: java.nio.file.FileSystemException: /Users/chegar/git/elasticsearch/distribution/archives/darwin-aarch64-tar/build/install/elasticsearch-8.0.0-SNAPSHOT/plugins/discovery-ec2-7.6.2.zip/plugin-descriptor.properties: Not a directory
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:375)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:426)
	at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
	at java.base/java.nio.file.Files.newInputStream(Files.java:160)
	at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:146)
	at org.elasticsearch.plugins.PluginsService.readPluginBundle(PluginsService.java:389)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Plugins Plugin API and infrastructure >enhancement good first issue low hanging fruit Team:Core/Infra Meta label for core/infra team
Projects
None yet
Development

No branches or pull requests

8 participants