Tune JVM, print full diagnostics on crash.
JVM occasionally (0.5% time) crashes on entering a method with SIGSEGV. It might be due to excessive load on the host machine. Reduce the number of the compiler threads to 6, and do not start all the GC threads immediately. If JVM crashes, copy full diagnostics to stderr. Bug: 132766811 Test: treehugger Change-Id: Ib7bfd568f6d32456bf623cbb615ffc990c326a34
This commit is contained in:
parent
d7607c1c99
commit
26c6d9e9fb
|
@ -31,7 +31,7 @@ import (
|
|||
var (
|
||||
Signapk = pctx.AndroidStaticRule("signapk",
|
||||
blueprint.RuleParams{
|
||||
Command: `${config.JavaCmd} -Djava.library.path=$$(dirname $signapkJniLibrary) ` +
|
||||
Command: `${config.JavaCmd} ${config.JavaVmFlags} -Djava.library.path=$$(dirname $signapkJniLibrary) ` +
|
||||
`-jar $signapkCmd $flags $certificates $in $out`,
|
||||
CommandDeps: []string{"$signapkCmd", "$signapkJniLibrary"},
|
||||
},
|
||||
|
|
|
@ -43,7 +43,8 @@ var (
|
|||
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
|
||||
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
|
||||
`(if [ -s $srcJarDir/list ] || [ -s $out.rsp ] ; then ` +
|
||||
`${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
|
||||
`${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ` +
|
||||
`${config.JavacHeapFlags} ${config.JavacVmFlags} ${config.CommonJdkFlags} ` +
|
||||
`$processorpath $processor $javacFlags $bootClasspath $classpath ` +
|
||||
`-source $javaVersion -target $javaVersion ` +
|
||||
`-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list ; fi ) && ` +
|
||||
|
@ -64,7 +65,7 @@ var (
|
|||
turbine = pctx.AndroidStaticRule("turbine",
|
||||
blueprint.RuleParams{
|
||||
Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` +
|
||||
`${config.JavaCmd} -jar ${config.TurbineJar} --output $out.tmp ` +
|
||||
`${config.JavaCmd} ${config.JavaVmFlags} -jar ${config.TurbineJar} --output $out.tmp ` +
|
||||
`--temp_dir "$outDir" --sources @$out.rsp --source_jars $srcJars ` +
|
||||
`--javacopts ${config.CommonJdkFlags} ` +
|
||||
`$javacFlags -source $javaVersion -target $javaVersion -- $bootClasspath $classpath && ` +
|
||||
|
@ -108,7 +109,7 @@ var (
|
|||
|
||||
jarjar = pctx.AndroidStaticRule("jarjar",
|
||||
blueprint.RuleParams{
|
||||
Command: "${config.JavaCmd} -jar ${config.JarjarCmd} process $rulesFile $in $out",
|
||||
Command: "${config.JavaCmd} ${config.JavaVmFlags} -jar ${config.JarjarCmd} process $rulesFile $in $out",
|
||||
CommandDeps: []string{"${config.JavaCmd}", "${config.JarjarCmd}", "$rulesFile"},
|
||||
},
|
||||
"rulesFile")
|
||||
|
@ -124,7 +125,7 @@ var (
|
|||
|
||||
jetifier = pctx.AndroidStaticRule("jetifier",
|
||||
blueprint.RuleParams{
|
||||
Command: "${config.JavaCmd} -jar ${config.JetifierJar} -l error -o $out -i $in",
|
||||
Command: "${config.JavaCmd} ${config.JavaVmFlags} -jar ${config.JetifierJar} -l error -o $out -i $in",
|
||||
CommandDeps: []string{"${config.JavaCmd}", "${config.JetifierJar}"},
|
||||
},
|
||||
)
|
||||
|
|
|
@ -69,6 +69,8 @@ func init() {
|
|||
// b/65004097: prevent using java.lang.invoke.StringConcatFactory when using -target 1.9
|
||||
`-XDstringConcat=inline`,
|
||||
}, " "))
|
||||
pctx.StaticVariable("JavaVmFlags", "-XX:OnError=\"cat hs_err_pid%p.log\" -XX:CICompilerCount=6 -XX:+UseDynamicNumberOfGCThreads")
|
||||
pctx.StaticVariable("JavacVmFlags", "-J-XX:OnError=\"cat hs_err_pid%p.log\" -J-XX:CICompilerCount=6 -J-XX:+UseDynamicNumberOfGCThreads")
|
||||
|
||||
pctx.VariableConfigMethod("hostPrebuiltTag", android.Config.PrebuiltOS)
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||
ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}")
|
||||
ctx.Strict("ANDROID_JAVA9_HOME", "prebuilts/jdk/jdk9/${hostPrebuiltTag}")
|
||||
ctx.Strict("ANDROID_JAVA_TOOLCHAIN", "${JavaToolchain}")
|
||||
ctx.Strict("JAVA", "${JavaCmd}")
|
||||
ctx.Strict("JAVAC", "${JavacCmd}")
|
||||
ctx.Strict("JAVA", "${JavaCmd} ${JavaVmFlags}")
|
||||
ctx.Strict("JAVAC", "${JavacCmd} ${JavacVmFlags}")
|
||||
ctx.Strict("JAR", "${JarCmd}")
|
||||
ctx.Strict("JAR_ARGS", "${JarArgsCmd}")
|
||||
ctx.Strict("JAVADOC", "${JavadocCmd}")
|
||||
|
@ -58,8 +58,8 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||
ctx.Strict("ERROR_PRONE_CHECKS", "${ErrorProneChecks}")
|
||||
}
|
||||
|
||||
ctx.Strict("TARGET_JAVAC", "${JavacCmd} ${CommonJdkFlags}")
|
||||
ctx.Strict("HOST_JAVAC", "${JavacCmd} ${CommonJdkFlags}")
|
||||
ctx.Strict("TARGET_JAVAC", "${JavacCmd} ${JavacVmFlags} ${CommonJdkFlags}")
|
||||
ctx.Strict("HOST_JAVAC", "${JavacCmd} ${JavacVmFlags} ${CommonJdkFlags}")
|
||||
|
||||
ctx.Strict("JLINK", "${JlinkCmd}")
|
||||
ctx.Strict("JMOD", "${JmodCmd}")
|
||||
|
|
|
@ -73,7 +73,7 @@ var (
|
|||
Command: `rm -rf "$outDir" "$srcJarDir" "$stubsDir" && ` +
|
||||
`mkdir -p "$outDir" "$srcJarDir" "$stubsDir" && ` +
|
||||
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
|
||||
`${config.JavaCmd} -jar ${config.MetalavaJar} -encoding UTF-8 -source $javaVersion @$out.rsp @$srcJarDir/list ` +
|
||||
`${config.JavaCmd} ${config.JavaVmFlags} -jar ${config.MetalavaJar} -encoding UTF-8 -source $javaVersion @$out.rsp @$srcJarDir/list ` +
|
||||
`$bootclasspathArgs $classpathArgs $sourcepathArgs --no-banner --color --quiet --format=v2 ` +
|
||||
`$opts && ` +
|
||||
`${config.SoongZipCmd} -write_if_changed -jar -o $out -C $stubsDir -D $stubsDir && ` +
|
||||
|
@ -95,7 +95,7 @@ var (
|
|||
blueprint.RuleParams{
|
||||
Command: `( rm -rf "$srcJarDir" && mkdir -p "$srcJarDir" && ` +
|
||||
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
|
||||
`${config.JavaCmd} -jar ${config.MetalavaJar} -encoding UTF-8 -source $javaVersion @$out.rsp @$srcJarDir/list ` +
|
||||
`${config.JavaCmd} ${config.JavaVmFlags} -jar ${config.MetalavaJar} -encoding UTF-8 -source $javaVersion @$out.rsp @$srcJarDir/list ` +
|
||||
`$bootclasspathArgs $classpathArgs $sourcepathArgs --no-banner --color --quiet --format=v2 ` +
|
||||
`$opts && touch $out && rm -rf "$srcJarDir") || ` +
|
||||
`( echo -e "$msg" ; exit 38 )`,
|
||||
|
@ -120,7 +120,7 @@ var (
|
|||
Command: `rm -rf "$outDir" "$srcJarDir" "$stubsDir" && ` +
|
||||
`mkdir -p "$outDir" "$srcJarDir" "$stubsDir" && ` +
|
||||
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
|
||||
`${config.JavaCmd} -jar ${config.DokkaJar} $srcJarDir ` +
|
||||
`${config.JavaCmd} ${config.JavaVmFlags} -jar ${config.DokkaJar} $srcJarDir ` +
|
||||
`$classpathArgs -format dac -dacRoot /reference/kotlin -output $outDir $opts && ` +
|
||||
`${config.SoongZipCmd} -write_if_changed -d -o $docZip -C $outDir -D $outDir && ` +
|
||||
`${config.SoongZipCmd} -write_if_changed -jar -o $out -C $stubsDir -D $stubsDir && ` +
|
||||
|
|
|
@ -31,7 +31,7 @@ var (
|
|||
jacoco = pctx.AndroidStaticRule("jacoco", blueprint.RuleParams{
|
||||
Command: `rm -rf $tmpDir && mkdir -p $tmpDir && ` +
|
||||
`${config.Zip2ZipCmd} -i $in -o $strippedJar $stripSpec && ` +
|
||||
`${config.JavaCmd} -jar ${config.JacocoCLIJar} ` +
|
||||
`${config.JavaCmd} ${config.JavaVmFlags} -jar ${config.JacocoCLIJar} ` +
|
||||
` instrument --quiet --dest $tmpDir $strippedJar && ` +
|
||||
`${config.Ziptime} $tmpJar && ` +
|
||||
`${config.MergeZipsCmd} --ignore-duplicates -j $out $tmpJar $in`,
|
||||
|
|
Loading…
Reference in New Issue