Skip to content
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

[grpc/protobuf] Update grpc to 1.65.5 and update protobuf to 5.26.1 #39800

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Tradias
Copy link
Contributor

@Tradias Tradias commented Jul 9, 2024

Fixes
#37440
#29697
#38316
#37729
#30583
#40803

Upstream issues:
Ultimaker/libArcus#156
apache/brpc#2757
sogou/srpc#406

Update to latest protobuf isn't possible because gRPC latest does not support it and it is difficult to patch (unstable upb API being the primary reason).

Some ports had to be patched to support protobuf v5.

upb now has (hopefully) proper stage0 build to generate descriptor.upb.h/c files. Seeing that the supposedly tested-for-staleness files here: https://github.com/protocolbuffers/protobuf/tree/v25.1/upb/cmake/google/protobuf are actually stale.

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version.
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

@MonicaLiu0311 MonicaLiu0311 added the category:port-update The issue is with a library, which is requesting update new revision label Jul 9, 2024
@Tradias Tradias marked this pull request as ready for review July 12, 2024 09:46
@Tradias
Copy link
Contributor Author

Tradias commented Jul 12, 2024

@MonicaLiu0311 ready for review.

@MonicaLiu0311 MonicaLiu0311 added requires:testing Needs tests added before merging and removed requires:testing Needs tests added before merging labels Jul 12, 2024
@MonicaLiu0311
Copy link
Contributor

grpc & protobuf & upb

All features are tested successfully in the following triplet:

x86-windows
x64-windows
x64-windows-static

openvino

Features onnx,paddle are tested successfully in the following triplet:

x64-windows
x64-windows-static

@MonicaLiu0311
Copy link
Contributor

@Tradias Please resolve the conflict.

Copy link
Contributor

@JavierMatosD JavierMatosD left a comment

Choose a reason for hiding this comment

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

Partial Review:

This PR is claiming to update grpc and protobuf, but I am also seeing updates for:

  • utf8-range
  • upb
  • srpc
  • openvino
  • brpc
  • arcus

Why are these changes needed for the version update? If they are not, please split apart into their own respective PRs. I'm not saying that the changes here wouldn't be accepted just that they should be reviewed on their own.

Update to latest protobuf isn't possible because gRPC latest does not support it and it is difficult to patch (unstable upb API being the primary reason).

Can you explain why grpc doesn't support latest protobuf? i.e., did grpc drop support for protobuf or is this an upstream bug? In general, we don't accept patches that add functionality that isn't present in upstream. That is, if grpc doesn't support latest protobuf and that is by design then we will not add the functionality through vcpkg. We typically only accept version updates to latest barring unique circumstances so this needs a bit more explanation.

In general, there are a lot of modifications to patches here. I need a bit of context as to why you are making those changes and whether or not they have been reported to upstream. Overall, these changes look fine, but I want to make sure we aren't creating more maintenance burden here by adding support for stuff that upstream by design does not support.

@@ -1,5 +1,262 @@
diff --git a/src/brpc/esp_message.cpp b/src/brpc/esp_message.cpp
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain where this patch is coming from? What problem does it solve and why is it needed to update grpc and protobuf? In general, this patch looks upstream-able.

Copy link
Contributor Author

@Tradias Tradias Jul 26, 2024

Choose a reason for hiding this comment

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

It addresses the breaking changes caused by the protobuf update from v4 to v5. It can certainly be upstreamed.

ErrorCollector() : _error_count(0) { }

- void AddError(const std::string& filename, int line, int column, const std::string& message) override
+ void RecordError(absl::string_view filename, int line, int column, absl::string_view message) override
Copy link
Contributor

Choose a reason for hiding this comment

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

Please explain why this patch is needed. This looks like something that is upstream-able.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It addresses the breaking changes caused by the protobuf update from v4 to v5. It can certainly be upstreamed.

Choose a reason for hiding this comment

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

@JavierMatosD It's been a long time. Have you noticed?

@Tradias
Copy link
Contributor Author

Tradias commented Jul 16, 2024

@JavierMatosD Thank you for looking into this pr (again). The story is very similar to the previous one #35781. We are trying to force a protobuf version onto libraries that don't support it (yet) or are unmaintained. I haven't created any reports upstream and honestly don't feel like doing it, so feel free to do so.

protobuf, utf8-range and upb all come from the same repository. I think it would be best to avoid updating one without the others. That also means that we cannot update to latest protobuf (which is support by gRPC) because the latest upb is not.

@JavierMatosD JavierMatosD added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jul 16, 2024
@Tradias Tradias changed the title [grpc/protobuf] Update grpc to 1.65.0 and update protobuf to 5.26.1 [grpc/protobuf] Update grpc to 1.65.2 and update protobuf to 5.26.1 Jul 27, 2024
@Tradias Tradias force-pushed the grpc-1-65-0 branch 2 times, most recently from 72241a3 to 9240d3c Compare August 2, 2024 18:47
@Tradias Tradias changed the title [grpc/protobuf] Update grpc to 1.65.2 and update protobuf to 5.26.1 [grpc/protobuf] Update grpc to 1.65.4 and update protobuf to 5.26.1 Aug 2, 2024
@pedrolamarao
Copy link

Thank you for your work on upgrading gRPC!
Is there anything the community can do to help this PR move forward?

@Tradias
Copy link
Contributor Author

Tradias commented Sep 4, 2024

Upstream "support protobuf v5" issues:

Ultimaker/libArcus#156
apache/brpc#2757
sogou/srpc#406

@AlangabSistemi
Copy link

When will this change be accepted? I need uds in windws (grpc>=1.63)

@pedrolamarao
Copy link

I have started to experiment with this branch to prepare my project for this upgrade.

It seems that I have hit a known problem with protobuf.

P:\dev\keys-native\build\vcpkg_installed\x64-windows-static-md\include\google\protobuf\map_field.h(682,66): error C2370
: 'google::protobuf::internal::MapField<Derived,Key,T,kKeyFieldType_,kValueFieldType_>::kVTable': redefinition; differe
nt storage class [P:\dev\keys-native\build\protobuf\keys-protobuf.vcxproj]
P:\dev\keys-native\build\vcpkg_installed\x64-windows-static-md\include\google\protobuf\map_field.h(682,66): error C2370
: 'google::protobuf::internal::MapField<Derived,Key,T,kKeyFieldType_,kValueFieldType_>::kVTable': redefinition; differe
nt storage class [P:\dev\keys-native\build\protobuf\keys-protobuf.vcxproj]
  (compiling source file 'src/main/proto/keys.pb.cc')
      P:\dev\keys-native\build\vcpkg_installed\x64-windows-static-md\include\google\protobuf\map_field.h(671,37):
      see declaration of 'google::protobuf::internal::MapField<Derived,Key,T,kKeyFieldType_,kValueFieldType_>::kVTable'

  (compiling source file 'src/main/proto/keys.grpc.pb.cc')
      P:\dev\keys-native\build\vcpkg_installed\x64-windows-static-md\include\google\protobuf\map_field.h(671,37):
      see declaration of 'google::protobuf::internal::MapField<Derived,Key,T,kKeyFieldType_,kValueFieldType_>::kVTable'

This seems the same symptom as #39459

@Tradias
Copy link
Contributor Author

Tradias commented Sep 18, 2024

@pedrolamarao You describe an issue that exists in the protobuf version on master. In the linked vcpkg issue you will find the protobuf commit that fixed it and if you check it out you can see that the fix made it into the protobuf version that this pull request introduces protocolbuffers/protobuf@f78f9c5. I also just compiled a small program with vcpkg master branch (failed as expected) and then with this branch, succeeded.

In other words, it looks like you did something wrong when trying to test this branch and instead used current master branch. Possible causes:

  • Forgot to remove builtin-baseline from your vcpkg.json file
  • VCPKG_ROOT env value is pointing at a different clone of vcpkg instead of the one where you checked out this branch

@pedrolamarao
Copy link

@Tradias thanks, that sounds likely, sorry for the noise.

@korDen
Copy link

korDen commented Sep 19, 2024

What needs to be done to move this forward? @JavierMatosD are you able to do a second pass?

@MonicaLiu0311
Copy link
Contributor

@BillyONeal Please take a look at this PR.

@FAKERINHEART
Copy link

FAKERINHEART commented Sep 26, 2024

hey, buddies when will it be merged?

@JavierMatosD
Copy link
Contributor

@BillyONeal, @vicroms, @data-queue discussed this today.

@BillyONeal - "protobuf and upb are owned by the same people, we should be picking versions that are intrinsically compatible with each other. If that means we can't update grpc, so be it. We are not upb, grpc, or protobuf maintainers and we are not qualified to review that. We have to pick some form of versioning/packaging story that preserves that and if it means we can't update that then we can't update that. We would need to file issues with upstream and get them to implement the fix."

@ras0219-msft - "It is a reimplementation of protobuf that is small, so it has independent implementation from protobuf but it is c, small, and unstable. It sounds like upb is not suitable for consumption. We should declare that upb only exists as a dependency of grpc and treated as such. Maybe the path forward is protobuf and upb become decoupled and upb and grpc become coupled."

@BillyONeal - "Maybe upb should be delisted"

@ras0219-msft - "Why was upb added in the first place?"

#8460 (comment) -> implies it is needed for grpc

@ras0219-msft - "grpc has their own vendor copies of all these dependencies. So presumably, they have a set of dependencies that works for them. We could just say that grpc owns this whole ecosystem and we use whatever versions grpc needs."

@BillyONeal - "That seems to be the thing that people want."

@BillyONeal - "We should delist upb. https://github.com/protocolbuffers/protobuf/tree/main/upb -> "For this reason, upb is not generally offered as a C library for direct consumption, and there are no releases."

Actions:

  • Delist upb and instruct grpc to use its vendored copy
  • Use the actual change that srpc accepted or even better update srpc instead of patching.

Questions:

  1. Is there a newer version of grpc that still uses the 4.x series of protobuf? See, https://protobuf.dev/support/version-support/. If so, we could do an update to that while we wait for other ports to catch up.

Since upstream has been notified approx 3 ago, we will give them another 3 weeks to respond before we start delisting ports.

@JavierMatosD JavierMatosD marked this pull request as draft September 26, 2024 23:23
@Tradias
Copy link
Contributor Author

Tradias commented Sep 27, 2024

@JavierMatosD Great conversation. This matches my knowledge of grpc, protobuf, upb ecosystem exactly. I would throw utf8-range into the mix too but I think it is OK to keep it as is for now. I have been advocating for removing upb for a while now. Seeing that I have been doing the latest gRPC updates, I know how painful it is to patch CMake support into upb and patch gRPC to use it; two things that upstream never intended for.

GRPC v1.62.3 seems to be the last version to use protobuf 4.x: Look at the commit message on protobuf submodule between https://github.com/grpc/grpc/tree/v1.62.3/third_party with https://github.com/grpc/grpc/tree/v1.63.2/third_party

@anders-wind
Copy link
Contributor

anders-wind commented Oct 8, 2024

clang-19 fails at compiling grpc on (1.60.0, vcpkg master) (due to a compiler warning)
This is however fixed (at least) in grpc 1.65.4 (see grpc/grpc#36805).
We would greatly appreciate an update.

@olejniczak
Copy link

Hi, it is great job, but the question is: when could it be merged? @JavierMatosD are all your requested changes already done?

@JavierMatosD
Copy link
Contributor

@Tradias, please mark this PR "ready for review" when you want me to review this again.

@Tradias
Copy link
Contributor Author

Tradias commented Oct 10, 2024

@JavierMatosD what is the verdict regarding upb now? Are we merging this pr first and then delist it?

@korDen
Copy link

korDen commented Oct 15, 2024

Perhaps mark the PR as ready for review, otherwise it may not get the attention.

@JavierMatosD
Copy link
Contributor

@Tradias, sorry for the late response. I believe the action items requested by the team last we spoke were:

  1. Delist upb and instruct grpc to use its vendored copy
  2. Use the accepted change in srpc or update it to include the desired changes.

We also agreed to give upstream 3 weeks to respond before we begin delisting ports. I believe it's been 3 weeks since libarcus, brpc, and srpc were notified.

@Tradias Tradias changed the title [grpc/protobuf] Update grpc to 1.65.4 and update protobuf to 5.26.1 [grpc/protobuf] Update grpc to 1.65.5 and update protobuf to 5.26.1 Oct 19, 2024
@Tradias Tradias marked this pull request as ready for review October 20, 2024 19:58
@Tradias
Copy link
Contributor Author

Tradias commented Oct 20, 2024

GRPC now uses built-in upb, tested successfully on x64-windows-static. Note that some patching is still needed to make it use the vcpkg utf8-range port.

SRPC now uses official patch, build successfully on x64-windows-static.

BRPC is also working on protobuf v5 support but I am waiting for it to be merged: apache/brpc#2782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-update The issue is with a library, which is requesting update new revision requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants