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

NPE when plugins dir is inaccessible #8839

Merged

Conversation

dadoonet
Copy link
Member

@dadoonet dadoonet commented Dec 9, 2014

Steps to reproduce:

  1. Download fresh es.
  2. sudo mkdir plugins && sudo chmod 0700 plugins
  3. Start elasticsearch
elasticsearch-1.4.1 λ ./bin/elasticsearch
[2014-12-09 12:18:59,025][INFO ][node                     ] [Piotr Rasputin] version[1.4.1], pid[16338], build[89d3241/2014-11-26T15:49:29Z]
[2014-12-09 12:18:59,025][INFO ][node                     ] [Piotr Rasputin] initializing ...
{1.4.1}: Initialization Failed ...
- NullPointerException[null]

Closes #8837.

@dadoonet dadoonet self-assigned this Dec 9, 2014
@dadoonet dadoonet force-pushed the issue/8837-NPE-plugins-not-readable branch from 64234a3 to 9b77ea6 Compare December 9, 2014 09:05
@dadoonet dadoonet added the review label Dec 9, 2014
@@ -469,7 +470,7 @@ protected static boolean hasLibExtension(Path lib) {
// Let's try to find all _site plugins we did not already found
Path pluginsFile = environment.pluginsFile();

if (!Files.exists(pluginsFile) || !Files.isDirectory(pluginsFile)) {
if (!FileSystemUtils.isAccessibleDirectory(pluginsFile, logger)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be == false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@bobrik
Copy link
Contributor

bobrik commented Dec 9, 2014

@dadoonet full stack trace in logs would help a lot.

{1.4.1}: Initialization Failed ...
- NullPointerException[null]

This wasn't in logs, actually. I had to run es manually in foreground to see it. Stack trace in log could give some clues to avoid running strace.

@dadoonet
Copy link
Member Author

dadoonet commented Dec 9, 2014

@bobrik Basically you can run elasticsearch with -Des.logger.level=TRACE. It will give some details. For example on master:

{2.0.0-SNAPSHOT}: Initialization Failed ...
- ElasticsearchIllegalStateException[Can't load site  plugins]
    AccessDeniedException[/Users/dpilato/Documents/Elasticsearch/dev/elasticsearch/plugins]
org.elasticsearch.ElasticsearchIllegalStateException: Can't load site  plugins
    at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:145)
    at org.elasticsearch.node.internal.InternalNode.<init>(InternalNode.java:149)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:72)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:196)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.nio.file.AccessDeniedException: /Users/dpilato/Documents/Elasticsearch/dev/elasticsearch/plugins
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:406)
    at java.nio.file.Files.newDirectoryStream(Files.java:413)
    at org.elasticsearch.plugins.PluginsService.loadSitePlugins(PluginsService.java:476)
    at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:140)
    ... 9 more

@bobrik
Copy link
Contributor

bobrik commented Dec 9, 2014

Yep, but maybe trace should be in logs even if not enabled if we fail at initialization?

@s1monw
Copy link
Contributor

s1monw commented Dec 15, 2014

LGTM

Steps to reproduce:

1. Download fresh es.
2. `sudo mkdir plugins && sudo chmod 0700 plugins`
3. Start elasticsearch

```
elasticsearch-1.4.1 λ ./bin/elasticsearch
[2014-12-09 12:18:59,025][INFO ][node                     ] [Piotr Rasputin] version[1.4.1], pid[16338], build[89d3241/2014-11-26T15:49:29Z]
[2014-12-09 12:18:59,025][INFO ][node                     ] [Piotr Rasputin] initializing ...
{1.4.1}: Initialization Failed ...
- NullPointerException[null]
```

Closes elastic#8837.
@dadoonet dadoonet force-pushed the issue/8837-NPE-plugins-not-readable branch from 9598949 to 90f2f1d Compare December 21, 2014 11:02
@dadoonet dadoonet removed the review label Dec 21, 2014
@dadoonet dadoonet merged commit 90f2f1d into elastic:master Dec 21, 2014
@dadoonet dadoonet deleted the issue/8837-NPE-plugins-not-readable branch December 21, 2014 11:22
@clintongormley clintongormley changed the title Plugins: NPE when plugins dir is inaccessible NPE when plugins dir is inaccessible Jun 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE when plugins dir is inaccessible
4 participants