I've been noticing that a rogue Gradle daemon has ...
# community-support
e
I've been noticing that a rogue Gradle daemon has been popping up every once in a while and is always busy. I grabbed two thread dumps a few seconds apart, and here is what is running (using https://spotify.github.io/threaddump-analyzer/):
Copy code
java.lang.ref.Reference.waitForReferencePendingList(java.base@22.0.2/Native Method)	Reference Handler
net.rubygrapefruit.platform.internal.jni.AbstractNativeFileEventFunctions$NativeFileWatcher.executeRunLoop0(Native Method)	File watcher server
org.gradle.internal.watch.registry.impl.DefaultFileWatcherRegistry$1.<init>(DefaultFileWatcherRegistry.java:84)	File watcher consumer
sun.nio.ch.DatagramChannelImpl.receive0(java.base@22.0.2/Native Method)	File lock request listener
sun.nio.ch.EPoll.wait(java.base@22.0.2/Native Method)	Handler for socket connection from /127.0.0.1:33035 to /127.0.0.1:37474
sun.nio.ch.Net.accept(java.base@22.0.2/Native Method)	Incoming local TCP Connector on port 33035
a few seconds later
Copy code
java.lang.ref.Reference.waitForReferencePendingList(java.base@22.0.2/Native Method)	Reference Handler
net.rubygrapefruit.platform.internal.jni.AbstractNativeFileEventFunctions$NativeFileWatcher.executeRunLoop0(Native Method)	File watcher server
sun.nio.ch.DatagramChannelImpl.receive0(java.base@22.0.2/Native Method)	File lock request listener
sun.nio.ch.EPoll.wait(java.base@22.0.2/Native Method)	Handler for socket connection from /127.0.0.1:33035 to /127.0.0.1:37474
sun.nio.ch.Net.accept(java.base@22.0.2/Native Method)	Incoming local TCP Connector on port 33035
Is there any way to figure out what is starting this daemon?
j
That's the native filesystem watching thread. It receives events from the operating system when things (files, directories...) are changed in the directories it watches and forwards them to the gradle daemon, eventually triggering various actions upon the changes.
e
I understand that, but 1. Why is it constantly running 2. Why is that daemon running
j
It would help to know a bit more about the context, e.g. OS and IDE
e
Ubuntu 24.04 Gradle 8.11 Latest Android Studio stable
j
I don't know much about Android Studio so take that for what it's worth, but it's likely to be an IDE sync process triggered by edits in build or source files, or sometimes just touching them with e.g. `git`; in IDEA when using Gradle as the build tool daemon processes are launched for that purpose
e
There's another daemon alive that behaves regularly, i.e. it is in a busy state when I'm running tasks, or the IDE is syncing, etc... once the work is done it goes into an idle state. This other daemon is always in a busy state.
j
can you try to figure out what is the parent process, e.g. with
ps afuwx
when it shows up? You will see the full process arguments there as well, that may help to figure out what is launching it