Karan Agrawal
01/29/2025, 10:25 AM-Dorg.gradle.daemon=false
did the trick.
But, same is not working with JDK21
gradle --no-daemon clean build
flag also launches daemon
Why I want to disable daemon?
On my build machine, gradle build completes, but does not exits. It hangs there for some reason unknown.
For this, with JDK 8, we had disabled daemon and it worked. Same is now happening for JDK21.
Gradle 8.6
Karan Agrawal
01/29/2025, 10:25 AMBUILD SUCCESSFUL in 1m 55s
35 actionable tasks: 29 executed, 6 up-to-date
Some of the file system contents retained in the virtual file system are on file systems that Gradle doesn't support watching. The relevant state was discarded to ensure changes to these locations are properly<-------------> 0% WAITINGe this by explicitly enabling file system watching.
Vampire
01/29/2025, 3:20 PM--no-daemon
almost always means "use a one-off daemon and shut it down after executing the build".
That --no-daemon
really does not start a daemon you have to make sure the CLI process is suitable for the build process, i.e is compatible with the necessary daemon args.
Most prominently these are JVM args and the instrumentation agent that Gradle uses to instrument the build classpath for example to detect configuration cache inputs and iirc for some other things.
If you run with --info
maybe, if not then when running with --debug
, you see the arguments with which the daemon is started and there you could extract what is necessary.Vampire
01/29/2025, 3:21 PM--no-daemon
is unnecessary, especially when using ephemeral build agents that are shut down after the build execution anyway.
It might be better invested time to find out and / or report, why the build is hanging.Karan Agrawal
01/29/2025, 3:25 PMVampire
01/29/2025, 3:34 PMgradle-profiler
to run through a profiling tool that can tell you where the time is spent?Vampire
01/29/2025, 3:38 PM--continuous
when you intended to use --continue
?
Because the WAITING
I think I've only seen before when using continuous mode.Karan Agrawal
01/29/2025, 4:29 PM"Stdin handler" #33 [1211019] prio=5 os_prio=0 cpu=1101.53ms elapsed=31499.58s tid=0x00007f2408011640 nid=1211019 in Object.wait() [0x00007f2455f4e000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait0(java.base@21.0.4/Native Method)
- waiting on <no object reference available>
at java.lang.Object.wait(java.base@21.0.4/Object.java:366)
at java.io.PipedInputStream.awaitSpace(java.base@21.0.4/PipedInputStream.java:279)
at java.io.PipedInputStream.receive(java.base@21.0.4/PipedInputStream.java:237)
- locked <0x00000000d0ebbbb8> (a java.io.PipedInputStream)
at java.io.PipedOutputStream.write(java.base@21.0.4/PipedOutputStream.java:154)
at java.io.OutputStream.write(java.base@21.0.4/OutputStream.java:124)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$1.onInput(ForwardClientInput.java:54)
at org.gradle.launcher.daemon.server.DefaultDaemonConnection$StdinQueue.doHandleCommand(DefaultDaemonConnection.java:299)
at org.gradle.launcher.daemon.server.DefaultDaemonConnection$StdinQueue.doHandleCommand(DefaultDaemonConnection.java:286)
at org.gradle.launcher.daemon.server.DefaultDaemonConnection$CommandQueue$1.run(DefaultDaemonConnection.java:259)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@21.0.4/ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@21.0.4/ThreadPoolExecutor.java:642)
at java.lang.Thread.runWith(java.base@21.0.4/Thread.java:1596)
at java.lang.Thread.run(java.base@21.0.4/Thread.java:1583)
Karan Agrawal
01/29/2025, 4:30 PMVampire
01/29/2025, 4:31 PMVampire
01/29/2025, 4:31 PMKaran Agrawal
01/29/2025, 4:32 PM--continuous
I have to check, but not setting/passing it explicitly in my buildsKaran Agrawal
01/29/2025, 4:35 PMKaran Agrawal
01/29/2025, 4:38 PMKaran Agrawal
01/31/2025, 2:23 PM--no-daemon / -Dorg.gradle.daemon=false
is set and let the user handle the failures, if any.
Or, print both the list so we can see the difference and match accordingly.
Daemon Hang State
My understanding is that daemon is not able to relay completion state to main and exit.
Let me know if there are ideas from the jstack or something to try to triage that problem.Vampire
01/31/2025, 4:38 PMDaemon Hang State
I have no idea. If you really think that is the cause, you should probably open a bug report with all information you have, so it could eventually be fixed if there really is some bug. Did you check whether continuous more is used or not? You could for example really check in a build
--scan
if that is possible.
If not, I think it might work too print out the value of https://docs.gradle.org/current/javadoc/org/gradle/StartParameter.html#isContinuous() to verify.Karan Agrawal
01/31/2025, 5:28 PM