"Could not create Security Manager": cause and fix identified

2,931 views
Skip to first unread message

Daz DeBoer

unread,
Sep 8, 2015, 8:41:23 AM9/8/15
to Gradle Development List

G’day
Early this year I first encountered this issue when trying to execute integration tests within IntelliJ.

Error occurred during initialization of VM
java.lang.InternalError: Could not create SecurityManager: jarjar.org.gradle.process.internal.child.BootstrapSecurityManager

The problem has been intermittent and difficult to reproduce, but I think I’ve finally got to the bottom of it. The fundamental issue is that the gradle-worker.jar, which is generated by JarJar at Gradle runtime, is generated incorrectly. It seems like the JarJar task will silently fail to do it’s job if there are duplicate files to be included in the jar. The fact that this jar file is generated at runtime made diagnosis a little more tricky.

The files that triggered this issue were duplicate package-info.java files: certain packages we present in multiple subprojects in the Gradle build, with a `package-info` file in both. This triggered a Javadoc warning, but caused no problem with CLI gradle. However, running from inside IntelliJ caused the gradle-worker.jar to be generated incorrectly (if it hadn’t already been generated by a CLI invocation).

I recently cleaned up the duplicate package-info.java files to remove the Javadoc warnings. I did this by adding checkstyle exceptions to suppressions.xml, and removing the duplicate files. In doing so, I seem to have resolved the BootstrapSecurityManager issue.

Steps to reproduce the issue:

  1. cp subprojects/language-jvm/src/main/java/org/gradle/api/tasks/compile/package-info.java subprojects/language-java/src/main/java/org/gradle/api/tasks/compile
  2. rm -r ~/.gradle/caches/2.8-xxxx/workerMain
  3. Execute the Gradle run configuration in IntelliJ

Steps to reproduce the issue:

Note that this issue also affected the gradle home directory in the generated `intTestImage`.

I'm just recording this for interest and posterity. If we see the issue again, we should first look for duplicate files that might be causing JarJar to fail.

Daz
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages