Could not create SecurityManager: worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager


(Gregorio Meraz) #1
:testClasses
:test
Error occurred during initialization of VM
java.lang.InternalError: Could not create SecurityManager: worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager
	at sun.misc.Launcher.<init>(Launcher.java:106)
	at sun.misc.Launcher.<clinit>(Launcher.java:57)
	at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1448)
	at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1433)

Could not write standard input to Gradle Test Executor 2.
java.io.IOException: Broken pipe
	at java.io.FileOutputStream.writeBytes(Native Method)
	at java.io.FileOutputStream.write(FileOutputStream.java:326)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
	at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:66)
	at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:51)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:745)
: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.

Context
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.