-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cquery --output=proto
crashes in ProtoOutputFormatterCallback.writeData: IllegalArgumentException: bufferSize must be >= 0
#17743
Comments
Hi @keithl-stripe, Is there a way we can reproduce the error/crash it our end. Thanks! |
Sure, just create a Bazel workspace by creating the following files in an empty directory:
# empty workspace
[
genrule(name = "gen%d" % i, cmd = "echo hi", outs=["gen%d.txt" % i])
for i in range(1000 * 1000 * 2)
] Then type: bazel --host_jvm_args=-Xmx40G cquery --output=proto :all > all-cquery.proto You will see:
|
This is pretty unfortunate. A similar issue was fixed for query, in 68d2181 (by @michajlo). You could do something similar here, streaming the I'm marking this as low-priority, we won't be able to pick this up, but if you want to send a PR we'll review it. |
The solution to this problem in Ideally both |
cc @zhengwei143 who will look into streamed proto for aquery. |
The fix has been commited in 607d0f7, which introduces |
We rolled this back due to a bug, will submit a roll forward with a fix soon. |
This has been reimplemented in aa88357. |
Description of the bug:
In a large monorepo with 45,000 Bazel packages, 300,000 targets, and 800,000 configured targets,
bazel cquery --output=proto
crashes because the field ofCqueryResult
proto is larger than the 2GB inherent limit in the proto wire format.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
bazel cquery --output=proto --keep_going 'deps(...)'
Which operating system are you running Bazel on?
Linux Ubuntu 20.04.1
What is the output of
bazel info release
?5.4.0
Have you found anything relevant by searching the web?
This may be because a field is more than 2GB - see protocolbuffers/protobuf#8075
Any other information, logs, or outputs that you want to share?
A simple fix might be to add a new output format, perhaps
--output=proto-stream
which is simply a stream ofConfiguredTarget
s. (Or if possible a stream ofConfiguredTarget
s andConfiguration
s – I don't know if protobuf makes it easy to parse a mixed stream of delimited protos)The text was updated successfully, but these errors were encountered: