Search code examples
gradleazure-devopsazure-devops-self-hosted-agentgradle-daemon

Gradle Daemon being killed in "Finalize Job" step


I've got a "Build" pipeline that runs gradlew build on my java code and then just exports the jar as an artifact.

It is currently running on a self hosted agent as I was hoping this will help speed up the compilation.

I noticed that at the start of every run it says it is starting a new daemon as the stopped ones can't be used.

In the "Finalize job" step it says "Start cleaning up orphan processes." and then "Terminate orphan process: pid (17162) (java)". In the image below you can see that it is indeed terminating the process of the daemon.

image of task and PID

I've tried running gradlew build on the server, and then running the CI and the CI then uses the gradle daemon. But if I have two builds running at once, the daemon will sometimes end as another is active.

Is there any way to stop the cleaning of orphan processes or keep the daemon running?

I've thought of a cron job to build something small to keep it running, but that feels like an awkward way of doing it.


Solution

  • Setting process.clean to false in the variables of the release pipeline stops the "finalize job" step from killing all processes.

    Setting variables in the release pipeline