0

I have a custom CI runner which builds our Gradle projects. The issue we are facing is that the Gradle daemons get stopped very quickly and so each job takes a very long time just because of the starting gradle daemons:

Starting a Gradle Daemon, 3 busy and 32 stopped Daemons could not be reused, use --status for details

Is there a way to keep some number of daemons fresh and ready? Eg. to have 20 daemons always ready?

Benny _
  • 9
  • 1
Vojtěch
  • 11,312
  • 31
  • 103
  • 173

1 Answers1

0

According to official document, I quote:

Gradle Daemon: a long-lived background process that executes your builds much more quickly than would otherwise be the case. We accomplish this by avoiding the expensive bootstrapping process as well as leveraging caching, by keeping data about your project in memory. Running Gradle builds with the Daemon is no different than without. Simply configure whether you want to use it or not — everything else is handled transparently by Gradle.

It means that if you see this

Starting a Gradle Daemon, 3 busy and 32 stopped Daemons could not be reused, use --status for details.

32 stopped Daemon is still present from previous builds and it may has plenty of reasons. We have already this and this in stackoverflow.

But about your issue I guess your CI runner is just inside temporary docker container, and every time docker container dispose all data in memory will be disposed too. So why do you need to use gradle daemon?

The best solution is disable gradle deamon. put this line org.gradle.daemon=false inside gradle.properties of your project it must be at root of your project if it's not create one.

This remark has already been discussed in this, this, this

Mahdi Yusefi
  • 441
  • 4
  • 13
  • I am using long-lived CI runners, that is why I want to keep the daemon fresh and not disable it. I have already seen the linked documents and questions, however this does not help. – Vojtěch Apr 27 '22 at 12:44