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

Improve startup exceptions (especially file permissions etc) #13050

Closed
wants to merge 1 commit into from

Conversation

rmuir
Copy link
Contributor

@rmuir rmuir commented Aug 21, 2015

Its probably likely users will configure paths and have issues (file not found, bad file permissions, etc).
Today the failure is pitiful:

Exception in thread "main" /path
        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.createDirectory(UnixFileSystemProvider.java:384)
        at java.nio.file.Files.createDirectory(Files.java:674)
        at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
        at java.nio.file.Files.createDirectories(Files.java:767)
        at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:171)
        at org.elasticsearch.bootstrap.Security.addPath(Security.java:151)
        at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:133)
        at org.elasticsearch.bootstrap.Security.configure(Security.java:57)
        at org.elasticsearch.bootstrap.Bootstrap.setupSecurity(Bootstrap.java:188)
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:166)
        at org.elasticsearch.bootstrap.Bootstrap.doMain(Bootstrap.java:281)
        at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:228)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:28)
Refer to the log for complete error details.

We need more context here, like this:

Exception in thread "main" java.lang.IllegalStateException: Unable to access 'path.data' (/path/to/data)
Likely root cause: java.nio.file.AccessDeniedException: /path
        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.createDirectory(UnixFileSystemProvider.java:384)
        at java.nio.file.Files.createDirectory(Files.java:674)
        at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
        at java.nio.file.Files.createDirectories(Files.java:767)
        at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:181)
        at org.elasticsearch.bootstrap.Security.addPath(Security.java:158)
        at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:133)
        at org.elasticsearch.bootstrap.Security.configure(Security.java:57)
        at org.elasticsearch.bootstrap.Bootstrap.setupSecurity(Bootstrap.java:188)
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:166)
        at org.elasticsearch.bootstrap.Bootstrap.doMain(Bootstrap.java:281)
        at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:228)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:28)
Refer to the log for complete error details.

// paths may not exist yet
ensureDirectoryExists(path);
/**
* Add access to path (and all files underneath it
Copy link
Member

Choose a reason for hiding this comment

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

nit: missing ending paren

@dakrone
Copy link
Member

dakrone commented Aug 21, 2015

LGTM

@rjernst
Copy link
Member

rjernst commented Aug 21, 2015

LGTM too!

@rmuir
Copy link
Contributor Author

rmuir commented Aug 21, 2015

Closed via d96af93

@rmuir rmuir closed this Aug 21, 2015
@lcawl lcawl added :Core/Infra/Core Core issues without another label and removed :Exceptions labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >enhancement v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants