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

Problems with file access through current alias (Elasticsearch 511) #1202

Closed
nikolaia opened this issue Jan 9, 2017 · 5 comments
Closed

Comments

@nikolaia
Copy link
Contributor

nikolaia commented Jan 9, 2017

Having some trouble with file access and the current linked folder. Using the following recipe (we have our own repo with recipes) fails when running elssrv install -> elssrv start because the JVM doesn't seem to get access to .jar files through the currentlink. When running the same commands from the version specific folder it works.

{
	"homepage": "https://www.elastic.co/products/elasticsearch",
	"version": "5.1.1",
	"depends": "openjdk180_102_2",
	"url": "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip",
	"hash": "sha1:d4b966c19c85dd2cb9a5b9750193f82f49e63717",
	"extract_dir": "elasticsearch-5.1.1",
	"bin": [["bin\\elasticsearch.bat"],["bin\\elasticsearch-service.bat", "elssrv"], ["bin\\elasticsearch-plugin.bat", "elsplugin"]]
}
@lukesampson
Copy link
Member

I don't know how Elasticsearch works or how to replicate this, sorry. Can you provide more info?

If I install this manifest replacing openjdk180_102_2 with just openjdk and run elssrv install it seems to work ok. Running elssrv start after that seems to fail no matter whether I run it from the default shim pointing at the current version, point the shim at the explicit version, or start it by calling the full path to elasticsearch-service.bat.

If I change $env:JAVA_HOME to the explicit version directory rather than current version directory, I get the same results.

The error in the logfile seems to be Failed creating java %JAVA_HOME%\jre\bin\server\jvm.dll, no matter if I set the $env:JAVA_HOME to the current directory or the explicit version directory.

@nikolaia
Copy link
Contributor Author

nikolaia commented Jan 9, 2017

Forgot to mention we install it using the --global flag. Starting .\elasticsearch from C:\ProgramData\scoop\apps\elasticsearch511\current\bin gives the following output:

C:\ProgramData\scoop\apps\elasticsearch511\current\bin> .\elasticsearch
[2017-01-09T12:22:53,988][INFO ][o.e.n.Node               ] [] initializing ...
[2017-01-09T12:22:54,041][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\ProgramData\scoop\apps\elasticsearch511\5.1.1\data\nodes\0" "write")
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.cli.Command.main(Command.java:62) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:89) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:82) ~[elasticsearch-5.1.1.jar:5.1.1]
Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\ProgramData\scoop\apps\elasticsearch511\5.1.1\data\nodes\0" "write")
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_102-2-ojdkbuild]
        at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_102-2-ojdkbuild]
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_102-2-ojdkbuild]
        at java.lang.SecurityManager.checkWrite(SecurityManager.java:979) ~[?:1.8.0_102-2-ojdkbuild]
        at sun.nio.fs.WindowsPath.checkWrite(WindowsPath.java:799) ~[?:?]
        at sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:491) ~[?:?]
        at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_102-2-ojdkbuild]
        at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_102-2-ojdkbuild]
        at java.nio.file.Files.createDirectories(Files.java:727) ~[?:1.8.0_102-2-ojdkbuild]
        at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:92) ~[lucene-core-6.3.0.jar:6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:47:11]
        at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41) ~[lucene-core-6.3.0.jar:6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:47:11]
        at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-6.3.0.jar:6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:47:11]
        at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:225) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.node.Node.<init>(Node.java:249) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.node.Node.<init>(Node.java:229) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.bootstrap.Bootstrap$6.<init>(Bootstrap.java:214) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:214) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:306) ~[elasticsearch-5.1.1.jar:5.1.1]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-5.1.1.jar:5.1.1]
        ... 6 more

While running it from the explicit version folder gives the following (normal/successfull output):

C:\ProgramData\scoop\apps\elasticsearch511\5.1.1\bin> .\elasticsearch
[2017-01-09T12:23:16,397][INFO ][o.e.n.Node               ] [] initializing ...
[2017-01-09T12:23:16,536][INFO ][o.e.e.NodeEnvironment    ] [wPcXlpb] using [1] data paths, mounts [[(C:)]], net usable_space [8.6gb], net total_space [69.5gb], spins? [unknown], types [NTFS]
[2017-01-09T12:23:16,537][INFO ][o.e.e.NodeEnvironment    ] [wPcXlpb] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-01-09T12:23:16,542][INFO ][o.e.n.Node               ] node name [wPcXlpb] derived from node ID [wPcXlpbMTMaaWDX5jM1OfA]; set [node.name] to override
[2017-01-09T12:23:16,546][INFO ][o.e.n.Node               ] version[5.1.1], pid[3592], build[5395e21/2016-12-06T12:36:15.409Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_102-2-ojdkbuild/25.102-b14]
[2017-01-09T12:23:18,395][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [aggs-matrix-stats]
[2017-01-09T12:23:18,397][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [ingest-common]
[2017-01-09T12:23:18,398][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [lang-expression]
[2017-01-09T12:23:18,399][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [lang-groovy]
[2017-01-09T12:23:18,399][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [lang-mustache]
[2017-01-09T12:23:18,400][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [lang-painless]
[2017-01-09T12:23:18,400][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [percolator]
[2017-01-09T12:23:18,402][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [reindex]
[2017-01-09T12:23:18,403][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [transport-netty3]
[2017-01-09T12:23:18,403][INFO ][o.e.p.PluginsService     ] [wPcXlpb] loaded module [transport-netty4]
[2017-01-09T12:23:18,407][INFO ][o.e.p.PluginsService     ] [wPcXlpb] no plugins loaded

Using the explicit version elasticsearch-service.bat seems to work fine for me:

C:\ProgramData\scoop\apps\elasticsearch511\5.1.1\bin> .\elasticsearch-service.bat install
Installing service      :  "elasticsearch-service-x64"
Using JAVA_HOME (64-bit):  "C:\programdata\scoop\apps\openjdk180_102_2\current"
The service 'elasticsearch-service-x64' has been installed.
C:\ProgramData\scoop\apps\elasticsearch511\5.1.1\bin> .\elasticsearch-service.bat start
The service 'elasticsearch-service-x64' has been started
C:\ProgramData\scoop\apps\elasticsearch511\5.1.1\bin> Invoke-RestMethod http://localhost:9200

name         : wPcXlpb
cluster_name : elasticsearch
cluster_uuid : 2aHfkbC8SgypY35Y0eSt1g
version      : @{number=5.1.1; build_hash=5395e21; build_date=2016-12-06T12:36:15.409Z; build_snapshot=False; lucene_version=6.3.0}
tagline      : You Know, for Search

C:\ProgramData\scoop\apps\elasticsearch511\5.1.1\bin>

EDIT: Just to clarify. We have our data folder outside of the scoop install folder (defined in our elasticsearch config), but it fails on the next step when it tries to load .jar file modules from the modules folder with a similar access denied error as the one above. This was just me reproducing the access error on my machine.

@lukesampson
Copy link
Member

Thanks—that narrows it down, but I'll have to do some more investigation.

For now, can you run scoop update; scoop config NO_JUNCTIONS 1 to go back to just explicit versions. This won't affect anything you've already installed, so you will need to re-install Elasticsearch.

@nikolaia
Copy link
Contributor Author

Works great. Thanks :)

C:\Users\nikolaia> scoop config NO_JUNCTIONS 1
C:\Users\nikolaia> scoop install elasticsearch511 --global
installing elasticsearch511 (5.1.1)
loading https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip from cache...
checking hash...ok
extracting...done
creating shim for
creating shim for elssrv
creating shim for elsplugin
elasticsearch511 (5.1.1) was installed successfully!
C:\Users\nikolaia> elssrv install
Installing service      :  "elasticsearch-service-x64"
Using JAVA_HOME (64-bit):  "C:\programdata\scoop\apps\openjdk180_102_2\current"
The service 'elasticsearch-service-x64' has been installed.
C:\Users\nikolaia> elssrv start
The service 'elasticsearch-service-x64' has been started

@r15ch13
Copy link
Member

r15ch13 commented May 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants