Description of the bug:
When compiling a large Android app we are seeing too many open files error when using workers similar to issue described here. We would like to let worker JVMs use max open file descriptors limit specified on the shell with -XX:-MaxFDLimit JVM args.
Ideally this can be done with build --jvmopt="-XX:-MaxFDLimit" which would attach the flag to java_binary targets or attach the jvm flag to java_binary as done here
But it seems that JavaBuilder receive their jvm flags from toolchain and it does not add user specified flags like java_binary impl does.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
genrule(
name = "gen_sample",
outs = ["Sample.java"],
cmd = """
cat << EOF > $@
class Sample {{
}}
EOF
""",
)
java_library(
name = "sample",
srcs = ["Sample.java"],
visibility = ["//visibility:public"],
)
bazelisk build //:sample --jvmopt="-XX:-MaxFDLimit"
> jcmd external/remote_java_tools/java_tools/JavaBuilder_deploy.jar VM.command_line
61633:
VM Arguments:
jvm_args: -XX:-CompactStrings --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --patch-module=java.compiler=external/remote_java_tools/java_tools/java_compiler.jar --patch-module=jdk.compiler=external/remote_java_tools/java_tools/jdk_compiler.jar
java_command: external/remote_java_tools/java_tools/JavaBuilder_deploy.jar --persistent_worker
java_class_path (initial): external/remote_java_tools/java_tools/JavaBuilder_deploy.jar
Launcher Type: SUN_STANDARD
As shown above, user specified flags are not added to JavaBuilder's JVM
Which operating system are you running Bazel on?
MacOS 12.6 (21G115)
What is the output of bazel info release?
release 5.3.1
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?
No response
Have you found anything relevant by searching the web?
Any other information, logs, or outputs that you want to share?
No response
Description of the bug:
When compiling a large Android app we are seeing too many open files error when using workers similar to issue described here. We would like to let worker JVMs use max open file descriptors limit specified on the shell with
-XX:-MaxFDLimitJVM args.Ideally this can be done with
build --jvmopt="-XX:-MaxFDLimit"which would attach the flag tojava_binarytargets or attach the jvm flag tojava_binaryas done hereBut it seems that JavaBuilder receive their jvm flags from toolchain and it does not add user specified flags like
java_binaryimpl does.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
bazelisk build //:sample --jvmopt="-XX:-MaxFDLimit"> jcmd external/remote_java_tools/java_tools/JavaBuilder_deploy.jar VM.command_line 61633: VM Arguments: jvm_args: -XX:-CompactStrings --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --patch-module=java.compiler=external/remote_java_tools/java_tools/java_compiler.jar --patch-module=jdk.compiler=external/remote_java_tools/java_tools/jdk_compiler.jar java_command: external/remote_java_tools/java_tools/JavaBuilder_deploy.jar --persistent_worker java_class_path (initial): external/remote_java_tools/java_tools/JavaBuilder_deploy.jar Launcher Type: SUN_STANDARDAs shown above, user specified flags are not added to JavaBuilder's JVM
Which operating system are you running Bazel on?
MacOS 12.6 (21G115)
What is the output of
bazel info release?release 5.3.1
If
bazel info releasereturnsdevelopment versionor(@non-git), tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD?No response
Have you found anything relevant by searching the web?
--host_jvmoptto host options attribute #15978Any other information, logs, or outputs that you want to share?
No response