renovatebot / docker-buildpack

MIT License
3 stars 12 forks source link

Gradle daemon still running after renovating repository #46

Closed alclonky closed 4 years ago

alclonky commented 4 years ago

What Renovate type are you using? whitesource/renovate

Describe the bug

Renovate startes an gradle daemon for each repository with gradle inside (same gradle version is reused, different version stays running)

gradle can be started without daemon (the daemon will be ended after run) https://docs.gradle.org/current/userguide/gradle_daemon.html

default@renovate-renovate-pro-7cbcbd6dd-zqgjq:/usr/src/app$ ps aux |grep gradle

default      228  0.5  1.1 3477980 790420 ?      Ssl  06:56   1:53 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/ubuntu/.gradle/wrapper/dists/gradle-5.2-bin/9yrnc2inuu4p0ylanusklg9pv/gradle-5.2/lib/gradle-launcher-5.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.2

default    14383  0.1  0.3 3292308 261596 ?      Ssl  07:45   0:29 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/ubuntu/.gradle/wrapper/dists/gradle-5.6.2-bin/8xw8k66iolvgcacwrbk2lxgq5/gradle-5.6.2/lib/gradle-launcher-5.6.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.6.2

default    15010  0.7  1.8 5046932 1216656 ?     Ssl  07:48   2:18 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/ubuntu/.gradle/wrapper/dists/gradle-5.6.4-bin/bxirm19lnfz6nurbatndyydux/gradle-5.6.4/lib/gradle-launcher-5.6.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.6.4

default    17292  0.4  1.1 8160660 787952 ?      Ssl  08:01   1:15 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx4096M -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/ubuntu/.gradle/wrapper/dists/gradle-5.6.4-all/etoh6efx14qlyb91dp8z5hxth/gradle-5.6.4/lib/gradle-launcher-5.6.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.6.4

default    28538  0.1  0.7 4563332 477996 ?      Ssl  08:48   0:26 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/ubuntu/.gradle/wrapper/dists/gradle-4.10-bin/egqyt8ra72bfhiofdk8k5qjqz/gradle-4.10/lib/gradle-launcher-4.10.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.10

default    31750  0.2  0.7 8121892 522984 ?      Ssl  09:06   0:31 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx4096m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/ubuntu/.gradle/wrapper/dists/gradle-5.6.4-all/36ors43i4dolb4mr4ix6qbiqo/gradle-5.6.4/lib/gradle-launcher-5.6.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.6.4
rarkins commented 4 years ago

@alclonky I'm not a Gradle user or expert but are you able to experiment with adding /home/ubuntu//.gradle/gradle.properties to your running container containing org.gradle.daemon=false and confirm if that prevents the problem? Or the env variable might be easier:

image

rarkins commented 4 years ago

@viceice @JamieMagee @ikesyo any opinions? We don't seem to be using GRADLE_OPTS yet so could set that easily.

viceice commented 4 years ago

@rarkins the daemon should already be disabled for our gradle docker images. So passing the env looks easier band will work for global tools too

rarkins commented 4 years ago

@viceice do you mean disabled for our renovate/gradle images but not for renovate/renovate ?

viceice commented 4 years ago

Yes I think so, have not verified it

rarkins commented 4 years ago

The renovate/gradle container contains all the following in gradle.properties:

org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.daemon=false
org.gradle.caching=false

Should we have all of them for renovate/renovate too?

viceice commented 4 years ago

We should do it while install gradle with our buildpack, so it will work transparently

alclonky commented 4 years ago

looks good in whitesource/renovate:1.0.1

rarkins commented 4 years ago

Thanks for confirming. I’ve addd it manually there as is done in renovate/gradle, but we still need a universal solution here in the buildpack.

viceice commented 4 years ago

@rarkins Do we prefer GRADLE_OPTS env or gradle.properties file ?

rarkins commented 4 years ago

@rarkins Do we prefer GRADLE_OPTS env or gradle.properties file ?

I think go with env if they are otherwise equal

viceice commented 4 years ago

I'm thinking of passing GRADLE_OPTS as extra env from renovate bot to exec function, so gradle will use them on tests and global too execution 🤔