Daemon starts anyway with --no-daemon command line option


(InverseBit) #1

I’m running my build with the --no-daemon command line option but a daemon process seems to start anyway and doesn’t quit at the end of the build.

$ ./gradlew --no-daemon -Penv=test clean war
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: http://gradle.org/docs/1.9/userguide/gradle_daemon.html.
.. snip

Running

./gradlew --stop

says no daemons are running but I can see the process running:

$ ps auxwww
admin 12130 54.9
4.0 3217408 1326560
3
SJ
 10:47AM 1:08.47 /usr/local/openjdk7/bin/java -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -Xmx2048m -Dfile.encoding=utf-8 -cp /home/admin/.gradle/wrapper/dists/gradle-1.9-all/3jdgemv0iv8uqohg3kcp2o88r1/gradle-1.9/lib/gradle-launcher-1.9.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.9 /usr/home/moovright/.gradle/daemon 120000 b0086b21-ef05-4cdc-9bae-60308be9625c -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -Xmx2048m -Dfile.encoding=utf-8

Every time I run a build a new process starts and never quits. Any ideas why this is happening?


(Luke Daley) #2

Are you sure that daemon process wasn’t there from another build?

‘gradle --stop’ won’t stop daemons running with a different version of Gradle.


(InverseBit) #3

Yes I’m sure. I kill off all running gradle processes, check they are really gone, then run the build and a new process appears.


(Luke Daley) #4

What are the org.gradle.jvmargs you have set ?


(InverseBit) #5

gradle.properties

org.gradle.jvmargs=-XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m -Dfile.encoding=utf-8 -XX:+PrintGCDetails

(Luke Daley) #6

I can’t reproduce. I created a build with that in gradle.properties, ran ‘gradle --no-daemon tasks’ and have no processes hanging around after.

Can you think of any other environmental factors?


(InverseBit) #7

The only thing I can think of is that it’s running on FreeBSD 9.2 within a jail.

openjdk version “1.7.0_25” OpenJDK Runtime Environment (build 1.7.0_25-b15) OpenJDK 64-Bit Server VM (build 23.21-b01, mixed mode)

In fact just testing this on Mac OS X and I don’t get the processes hanging around.


(Luke Daley) #8

Are you able to try on that env not in a jail to narrow it down?


(InverseBit) #9

Just tried and I get the same behaviour when not inside a jail - process hangs around.


(Luke Daley) #10

Raised as GRADLE-3003.

Being OS specific makes it harder to track something like this down. None of the developers are using FreeBSD and we don’t have any CI coverage for it.

The daemon log might provide some insight. Would you mind providing it?

Unless you’ve set GRADLE_USER_HOME, it will be in ~/.gradle/daemon/1.9 and the name will have the pid in it.


(InverseBit) #11

Sure - added daemon log to GRADLE-3003


(Adam Murdoch) #12

There’s nothing unusual in the log file.

Could you also do a thread dump of the daemon process, eg using ‘jstack’?


(InverseBit) #13
2014-01-27 05:35:34
Full thread dump OpenJDK 64-Bit Server VM (23.21-b01 mixed mode):
  "Attach Listener" daemon prio=5 tid=0x00000008b246e000 nid=0x8a7169800 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
  "File lock request listener" prio=5 tid=0x00000008a7324800 nid=0x8a716a400 runnable [0x00007ffffe6e8000]
   java.lang.Thread.State: RUNNABLE
 at java.net.PlainDatagramSocketImpl.receive0(Native Method)
 - locked <0x000000082715b398> (a java.net.PlainDatagramSocketImpl)
 at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:145)
 - locked <0x000000082715b398> (a java.net.PlainDatagramSocketImpl)
 at java.net.DatagramSocket.receive(DatagramSocket.java:786)
 - locked <0x000000082691cbc0> (a java.net.DatagramPacket)
 - locked <0x0000000826b86d68> (a java.net.DatagramSocket)
 at org.gradle.cache.internal.FileLockCommunicator.receive(FileLockCommunicator.java:60)
 at org.gradle.cache.internal.locklistener.DefaultFileLockContentionHandler$1.doRun(DefaultFileLockContentionHandler.java:66)
 at org.gradle.cache.internal.locklistener.DefaultFileLockContentionHandler$1.run(DefaultFileLockContentionHandler.java:53)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:724)
  "Incoming local TCP Connector on port 26883" prio=5 tid=0x000000080115b000 nid=0x8010fbc00 runnable [0x00007ffffeaec000]
   java.lang.Thread.State: RUNNABLE
 at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
 at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:241)
 - locked <0x000000082715af18> (a java.lang.Object)
 at org.gradle.messaging.remote.internal.inet.TcpIncomingConnector$Receiver.run(TcpIncomingConnector.java:110)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:724)
  "Service Thread" daemon prio=5 tid=0x0000000801156800 nid=0x801047400 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
  "C2 CompilerThread1" daemon prio=5 tid=0x0000000801155800 nid=0x801046800 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
  "C2 CompilerThread0" daemon prio=5 tid=0x0000000801155000 nid=0x801045c00 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
  "Signal Dispatcher" daemon prio=5 tid=0x0000000801154000 nid=0x801045000 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
  "Finalizer" daemon prio=5 tid=0x0000000801153800 nid=0x801043c00 in Object.wait() [0x00007fffff0f2000]
   java.lang.Thread.State: WAITING (on object monitor)
 at java.lang.Object.wait(Native Method)
 - waiting on <0x0000000826852050> (a java.lang.ref.ReferenceQueue$Lock)
 at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
 - locked <0x0000000826852050> (a java.lang.ref.ReferenceQueue$Lock)
 at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
 at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:189)
  "Reference Handler" daemon prio=5 tid=0x0000000801152800 nid=0x801043000 in Object.wait() [0x00007fffff1f3000]
   java.lang.Thread.State: WAITING (on object monitor)
 at java.lang.Object.wait(Native Method)
 - waiting on <0x00000008268f6ff8> (a java.lang.ref.Reference$Lock)
 at java.lang.Object.wait(Object.java:503)
 at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
 - locked <0x00000008268f6ff8> (a java.lang.ref.Reference$Lock)
  "main" prio=5 tid=0x0000000801152000 nid=0x801007800 waiting on condition [0x00007fffffbfc000]
   java.lang.Thread.State: TIMED_WAITING (parking)
 at sun.misc.Unsafe.park(Native Method)
 - parking to wait for
<0x000000082715b2d0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
 at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
 at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2082)
 at java.util.concurrent.ThreadPoolExecutor.awaitTermination(ThreadPoolExecutor.java:1468)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl.stop(DefaultExecutorFactory.java:93)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl.stop(DefaultExecutorFactory.java:83)
 at org.gradle.messaging.remote.internal.inet.TcpIncomingConnector$1.stop(TcpIncomingConnector.java:88)
 at org.gradle.internal.CompositeStoppable.stop(CompositeStoppable.java:122)
 at org.gradle.launcher.daemon.server.DaemonTcpServerConnector.stop(DaemonTcpServerConnector.java:87)
 at org.gradle.internal.CompositeStoppable.stop(CompositeStoppable.java:122)
 at org.gradle.launcher.daemon.server.Daemon.stop(Daemon.java:164)
 at org.gradle.launcher.daemon.bootstrap.DaemonMain.doAction(DaemonMain.java:120)
 at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
 at org.gradle.launcher.daemon.bootstrap.DaemonMain.main(DaemonMain.java:82)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
 at org.gradle.launcher.daemon.bootstrap.GradleDaemon.main(GradleDaemon.java:22)
  "VM Thread" prio=5 tid=0x000000080128b800 nid=0x801042400 runnable
  "GC task thread#0 (ParallelGC)" prio=5 tid=0x0000000801285800 nid=0x80103bc00 runnable
  "GC task thread#1 (ParallelGC)" prio=5 tid=0x0000000801286800 nid=0x80103c800 runnable
  "GC task thread#2 (ParallelGC)" prio=5 tid=0x0000000801287000 nid=0x80103d400 runnable
  "GC task thread#3 (ParallelGC)" prio=5 tid=0x0000000801287800 nid=0x80103e000 runnable
  "GC task thread#4 (ParallelGC)" prio=5 tid=0x0000000801288000 nid=0x80103ec00 runnable
  "GC task thread#5 (ParallelGC)" prio=5 tid=0x0000000801289000 nid=0x80103f800 runnable
  "GC task thread#6 (ParallelGC)" prio=5 tid=0x0000000801289800 nid=0x801040400 runnable
  "GC task thread#7 (ParallelGC)" prio=5 tid=0x000000080128a000 nid=0x801041000 runnable
  "VM Periodic Task Thread" prio=5 tid=0x000000080128c000 nid=0x801048000 waiting on condition
  JNI global references: 281

(Adam Murdoch) #14

That thread blocked in ServerSocketChannel.accept() should have unblocked when the ‘main’ thread closed the channel. Perhaps some FreeBSD + JVM bug?