Could not create SecurityManager:

Error occurred during initialization of VM
java.lang.InternalError: Could not create SecurityManager:
	at sun.misc.Launcher.<init>(
	at sun.misc.Launcher.<clinit>(
	at java.lang.ClassLoader.initSystemClassLoader(
	at java.lang.ClassLoader.getSystemClassLoader(

Could not write standard input to Gradle Test Executor 2. Broken pipe
	at Method)
	at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(
	at org.gradle.internal.concurrent.ManagedExecutorImpl$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$
	at org.gradle.internal.concurrent.ThreadFactoryImpl$
:test FAILED

FAILURE: Build failed with an exception.

Expected Behavior
Test suite should be initialized without issues and build should go fine. On local enviroments it is working as expected

Current Behavior
Getting exception each time the test task gets executed, the only way the test task passes is if we comment out all the test classes. Even a dummy test class with assert true will break the build.
we have tried with spock, junit and testNG and all give the same exception even with dummy test classes.

We have tried already by deleting the .gradle/caches folder and still no luck.
We also tried by overriding the SecurityManager and it still gave the same exception.
Our theory is that the gradle-worker.jar generated by :compileGroovy task is not working as expected.

As a note, if we skip the tests and build the app, it works fine and as expected, its only the test task which seems to be failing.

Your Environment
The build is being done with Jenkins in a LINUX slave server with Java 8, grails 3 and groovy.
Gradle being used is 4.6 but we had tried also with 3.5 and is the same error.

We have already gone trough all the webpages where this exception is mentioned and tried all posible solutions and still no luck.

1 Like