intellij-ideaelasticsearchaccesscontrolexception

Running unit tests for Elasticsearch 2.2.0 fails with AccessControlException: access denied


I have a unit-test which uses the integration-test-framework of Elasticsearch. It works fine when executed with Elasticsearch 2.0.0-2.1.2, however when I run the latest Elasticsearch 2.2.0 in IntelliJ, I get the following, any idea what needs to be adjusted to not use a security manager in IntelliJ?

java.security.AccessControlException: access denied ("org.elasticsearch.ThreadPermission" "modifyArbitraryThreadGroup")

at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at org.elasticsearch.SecureSM.checkThreadGroupAccess(SecureSM.java:166)
at org.elasticsearch.SecureSM.checkAccess(SecureSM.java:113)
at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)
at java.lang.ThreadGroup.getParent(ThreadGroup.java:167)
at com.carrotsearch.randomizedtesting.Threads$2.run(Threads.java:127)
at com.carrotsearch.randomizedtesting.Threads$2.run(Threads.java:123)
at java.security.AccessController.doPrivileged(Native Method)
at com.carrotsearch.randomizedtesting.Threads.getTopThreadGroup(Threads.java:123)
at com.carrotsearch.randomizedtesting.Threads.getAllThreads(Threads.java:99)
at com.carrotsearch.randomizedtesting.ThreadLeakControl.<init>(ThreadLeakControl.java:348)
at com.carrotsearch.randomizedtesting.RandomizedRunner.runSuite(RandomizedRunner.java:673)
at com.carrotsearch.randomizedtesting.RandomizedRunner.access$200(RandomizedRunner.java:140)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:591)

Solution

  • At least locally setting -Dtests.security.manager=false in the intellij VM options or on the command line disables the security manager.

    This sounds like a bug.

    Posted an issue on ES github: https://github.com/elastic/elasticsearch/issues/16459