Using --no-daemon, but still see a process called "Gradle Worker Daemon 1"


(James) #1

In our CI (Jenkins) build we run several operations using gradle and the --no-daemon flag. When I look at our Jenkins processes (via the Monitoring plugin) there is something called Gradle Worker Daemon 1" which I was not expecting. This daemon then creates the Gradle Test Executors.

My question is why is the daemon being created when we specify --no-daemon?

java -Dorg.gradle.appname=gradlew -classpath /home/ubuntu/workspace/<redacted> org.gradle.wrapper.GradleWrapperMain MyTests --no-daemon -Dgeb.env=<redacted>

This process creates the below process which calls itself Gradle Worker Daemon 1.

/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/bin/java -Djava.security.manager=worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /home/ubuntu/.gradle/caches/4.6/workerMain/gradle-worker.jar worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 1'

This process then spawns the Test Executor below.

/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/bin/java -Dawt.toolkit=sun.awt.X11.XToolkit -Dfile.encoding.pkg=sun.io -Dfile.separator=/ -Dgeb.env=<redacted> -Djava.awt.graphicsenv=sun.awt.X11GraphicsEnvironment -Djava.awt.printerjob=sun.print.PSPrinterJob -Djava.class.path=/home/ubuntu/workspace/<redacted>gradle-wrapper.jar -Djava.class.version=52.0 -Djava.endorsed.dirs=/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/endorsed -Djava.ext.dirs=/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/ext:/usr/java/packages/lib/ext -Djava.home=/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre -Djava.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib -Djava.runtime.name=Java(TM) SE Runtime Environment -Djava.runtime.version=1.8.0_121-b13 -Djava.security.manager=worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager -Djava.specification.name=Java Platform API Specification -Djava.specification.vendor=Oracle Corporation -Djava.specification.version=1.8 -Djava.vendor=Oracle Corporation -Djava.vendor.url=http://java.oracle.com/ -Djava.vendor.url.bug=http://bugreport.sun.com/bugreport/ -Djava.version=1.8.0_121 -Djava.vm.info=mixed mode -Djava.vm.name=Java HotSpot(TM) 64-Bit Server VM -Djava.vm.specification.name=Java Virtual Machine Specification -Djava.vm.specification.vendor=Oracle Corporation -Djava.vm.specification.version=1.8 -Djava.vm.vendor=Oracle Corporation -Djava.vm.version=25.121-b13 -Dlibrary.jansi.path=/home/ubuntu/.gradle/native/jansi/1.14/linux64 -Dline.separator= -Dorg.gradle.appname=gradlew -Dorg.gradle.native=false -Dos.arch=amd64 -Dos.name=Linux -Dos.version=4.4.0-1063-aws -Dpath.separator=: -Dspock.configuration=<redacted>Config.groovy -Dsun.arch.data.model=64 -Dsun.boot.class.path=/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/resources.jar:/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/rt.jar:/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/sunrsasign.jar:/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/jsse.jar:/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/jce.jar:/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/charsets.jar:/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/jfr.jar:/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/classes -Dsun.boot.library.path=/home/ubuntu/tools/hudson.model.JDK/JDK_8u121/jre/lib/amd64 -Dsun.cpu.endian=little -Dsun.cpu.isalist -Dsun.io.unicode.encoding=UnicodeLittle -Dsun.java.command=org.gradle.wrapper.GradleWrapperMain MyTests --no-daemon <redacted> -Dsun.java.launcher=SUN_STANDARD -Dsun.jnu.encoding=UTF-8 -Dsun.management.compiler=HotSpot 64-Bit Tiered Compilers -Dsun.os.patch.level=unknown -Duser.dir=<redacted> -Duser.home=/home/ubuntu -Duser.name=ubuntu -Duser.timezone=Etc/UTC -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/tmp -Duser.country=US -Duser.language=en -Duser.variant -ea -cp /home/ubuntu/.gradle/caches/4.6/workerMain/gradle-worker.jar worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 259'


(James Justinic) #2

The process run by Gradle to execute a build is the same whether or not you enable or disable the daemon. The behavior of the process after a build completes is the difference.

With the daemon enabled, the process will continue running in the background and can reused for a subsequent build. With the daemon disabled, the process is terminated at the end of the build. Even with the daemon disabled, you will still see a process labeled as a daemon. It doesn’t mean it will continue running in the background like a daemon.


(James) #3

I appreciate your response. That clears it up for me.