Skip to content

Comments

Use --output=streamed_proto if supported#117

Merged
illicitonion merged 2 commits intobazel-contrib:mainfrom
fmeum:streamed-proto
Jul 12, 2025
Merged

Use --output=streamed_proto if supported#117
illicitonion merged 2 commits intobazel-contrib:mainfrom
fmeum:streamed-proto

Conversation

@fmeum
Copy link
Member

@fmeum fmeum commented Jul 9, 2025

This avoids reading a single giant proto message with all configured targets. Instead, Bazel streams out invidual length-delimited configured target protos, which is more memory efficient and also supports result sizes > 2GB.

@fmeum fmeum marked this pull request as draft July 9, 2025 11:56
@fmeum fmeum changed the title Use --output=streamed_proto if available` Use --output=streamed_proto if available Jul 9, 2025
@fmeum fmeum force-pushed the streamed-proto branch from 27826dd to e106526 Compare July 9, 2025 13:12
@fmeum fmeum changed the title Use --output=streamed_proto if available Use --output=streamed_proto if supported Jul 9, 2025
@fmeum fmeum force-pushed the streamed-proto branch from e106526 to d917042 Compare July 9, 2025 13:14
@fmeum fmeum requested a review from sitaktif July 9, 2025 13:14
@fmeum fmeum marked this pull request as ready for review July 9, 2025 13:14
This avoids reading a single giant proto message with all configured targets. Instead, Bazel streams out invidual length-delimited configured target protos, which is more memory efficient and also supports result sizes > 2GB.
@fmeum fmeum force-pushed the streamed-proto branch from d917042 to 57da5a8 Compare July 9, 2025 14:50
@fmeum
Copy link
Member Author

fmeum commented Jul 9, 2025

@sitaktif Ready for review now, I had to run go mod tidy

Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@illicitonion illicitonion merged commit 1e25331 into bazel-contrib:main Jul 12, 2025
2 checks passed
@fmeum fmeum deleted the streamed-proto branch July 15, 2025 09:29
@honnix
Copy link
Contributor

honnix commented Sep 25, 2025

I tried the HEAD of main branch but got this error failed to unmarshal streamed cquery stdout: proto: cannot parse invalid wire-format data, which seems to be caused by this change. I will see whether I could get more error messages.

@honnix
Copy link
Contributor

honnix commented Oct 3, 2025

I tried the HEAD of main branch but got this error failed to unmarshal streamed cquery stdout: proto: cannot parse invalid wire-format data, which seems to be caused by this change. I will see whether I could get more error messages.

@fmeum Have you got time to take a look at this? Thank you.

@fmeum
Copy link
Member Author

fmeum commented Oct 3, 2025

@honnix How are you using target-determinator? Can you reproduce this on a small project?

@honnix
Copy link
Contributor

honnix commented Oct 3, 2025

@honnix How are you using target-determinator? Can you reproduce this on a small project?

Very basic usage of target-determinator. I tested using this command /path/to/target-determinator.darwin.arm64 --enforce-clean=enforce-clean --targets='//...'.

That said we have tons of stuff in .bazelrc. I will try to come up with a repro.

@honnix
Copy link
Contributor

honnix commented Oct 6, 2025

Actually if I try to upgrade bazel used by this repo to 8.4.0, I could already see the same issue.

@fmeum
Copy link
Member Author

fmeum commented Oct 7, 2025

Actually if I try to upgrade bazel used by this repo to 8.4.0, I could already see the same issue.

Did this happen when you run the tests? I can't reproduce the issue in that way. I haven't used target-determinator yet, so if you can share the exact command to run on its repo, that would be appreciated. :-)

@honnix
Copy link
Contributor

honnix commented Oct 7, 2025

Sure.

  • Upgrade bazel to 8.4.0 (actually any version supporting streamed proto) in .bazelversion, commit the change
  • bazel build //target-determinator
  • bazel-bin/target-determinator/target-determinator_/target-determinator --enforce-clean=enforce-clean --targets="//target-determinator" HEAD~1

@honnix
Copy link
Contributor

honnix commented Oct 7, 2025

Did this happen when you run the tests?

No it doesn't happen with tests because I think everything is running under Bazel 7.5.0:

@fmeum
Copy link
Member Author

fmeum commented Oct 7, 2025

@honnix Sent #120, could you test it?

@honnix
Copy link
Contributor

honnix commented Oct 7, 2025

@honnix Sent #120, could you test it?

That makes a lot of sense. I will test it asap.

@honnix
Copy link
Contributor

honnix commented Oct 8, 2025

@honnix Sent #120, could you test it?

@fmeum I can confirm this fixes the issue. Thank you for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants