Repository navigation
Description
Edit by @ejona86: Protobuf has resolved the incompatibility with protobuf-java 4.x. For current status, see my two comments starting at #11015 (comment)
Edit by @ejona86: Protobuf 4.33 supports all 3.x generated code, so most things preventing people from upgrading should be resolved. Even though it supports 3.x generated code, that is just to make it easier for you to upgrade to the newer codegen; 5.x will probably still be dropping 3.x codegen support. #11015 (comment)
Is your feature request related to a problem?
I would like to use the latest released version of Protobuf (4.26.0) but I cannot as gRPC is still using the old version.
Describe the solution you'd like
Update Protobuf dependency and make it work with the new version.
Describe alternatives you've considered
I hoped that the update would be easy (just a version bump) so I tried doing it myself but it resulted in a compilation failure so I'll leave it to you to figure it out.
The failure:
> Task :grpc-protobuf:compileJava FAILED
grpc-java/protobuf/src/main/java/io/grpc/protobuf/StatusProto.java:38: error: cannot access GeneratedMessageV3
ProtoLiteUtils.metadataMarshaller(com.google.rpc.Status.getDefaultInstance()));
^
class file for com.google.protobuf.GeneratedMessageV3 not found
grpc-java/protobuf/src/main/java/io/grpc/protobuf/StatusProto.java:171: error: cannot access Builder
.setCode(status.getCode().value());
^
class file for com.google.protobuf.GeneratedMessageV3$Builder not found
2 errors
Activity
ganadist commentedon Mar 15, 2024
https://protobuf.dev/news/2023-12-05
Also, I'm wondering how this protobuf changes will affect
ejona86 commentedon Mar 15, 2024
The protobuf breakage is pretty serious and goes against wisdom like https://jlbp.dev/JLBP-7 . I don't see how the community can absorb it. googleapis libraries are hit even harder than we are, so I think we'd wait until they have an idea how to deal with this (otherwise they couldn't upgrade to newer grpc versions). I don't expect that to be too big of a problem for the community, as I think most protobuf-using projects will be in shock.
I'm in discussions with others, but I'd expect the process to figure this out to take months.
augi commentedon Mar 17, 2024
After updating to Protobuf 4.26.0, we observe this issue:
The announcement of the Protobuf release contains this:
[Java] The base class for generated messages will be GeneratedMessage, not GeneratedMessageV3.So I guess this has to be adjusted.
[-]Update to Protobuf 4.26.0[/-][+]Update to Protobuf 4.x[/+]suztomo commentedon Mar 22, 2024
@neeme-praks-sympower Does any library or dependency require you to upgrade Protobuf runtime version to 4.x?
be-hase commentedon Mar 22, 2024
It seems that
proto-google-common-protos, which grpc-protobuf depends on, is not yet ver4 compliant.https://github.com/googleapis/sdk-platform-java/tree/main/java-common-protos
fix: Downgrade Protobuf for 4.x to 3.x
fix: Downgrade Protobuf from 4.x to 3.x
fix: Downgrade Protobuf from 4.x to 3.x
krickert commentedon Mar 30, 2024
Why couldn't grpc just bring back generated message v3? The classes appear almost identical, I suppose it can just extend it?
I tried that myself - it somewhat worked. I got past the generated message v3 error, but I was getting serializaiton errors everywhere. I think they may have changed the serializaiton spec too?
Anyway, I'm looking forward to this fix. I might try this again today.
neeme-praks-sympower commentedon Apr 1, 2024
No. We just try to keep our dependencies up-to-date.
34 remaining items
ejona86 commentedon Jan 15, 2025
@infa-kvaibhav,
makeExtensionsImmutable()is from ~21.7 and older which is too-old of generated code. The library needs to be rebuilt with protoc 25 to support both 3.x and 4.x. See protocolbuffers/protobuf#17247 (comment)Align Java grpc/protobuf versions
Align Java grpc/protobuf versions
Align Java grpc/protobuf versions
Align Java grpc/protobuf versions
Align Java grpc/protobuf versions
Align Java grpc/protobuf versions
Align Java grpc/protobuf versions
abasu0713 commentedon Jul 6, 2025
I have spent over 4 days trying this out to no avail. And it's a bit frustrating to be honest. Pardon my candor.
I have multiple server implementations.. Some written in Dart, some in Go, some in Python.. I generate stubs myself. all using latest protoc version 4.29.3. I use multiple clients as well. Some written in Flutter and some in JS Frameworks. They all work seamlessly even with grpc-web with json transcoding for rest over Envoy.
I need to write a Java based Events Listener SPI for Keycloak where I am using grpc java client to talk to dart and go servers as a post auth hook on keycloak. I have not been able to get it working. I keep getting the following error.
My Maven dependencies look like the following:
Can someone give me some idea what is going on?
ascopes commentedon Jul 6, 2025
@abasu0713 this probably isn't the answer but just if you were not aware, the newest version of protoc and protobuf-java is 4.31.1; I've got that working with grpc-java 1.73.0 in basic integration tests (nothing as complex as what you need though!) so it may be worth trying with that as well. I doubt it will fix your issue but it rules that out at the very least.
h-vetinari commentedon Jul 6, 2025
Just to note that latest right now is v31.1 (the baseline protobuf version; the leading major versions are different per language, i.e. 4.31.1 on the java side)
Edit: sorry, I hadn't seen that there was another comment to the same effect before I wrote my own.
ejona86 commentedon Jul 7, 2025
@abasu0713, I don't see anything about your report that makes it seem related to protobuf. Please open a new issue to discuss instead of doing it here.
Is there no more log information, like an exception stack trace or the like? Did you write the code for SignupEventListenerProvider?
ejona86 commentedon Aug 13, 2025
FYI: Protobuf 32 is adding support for older generated code. See the rc2 release notes:
https://github.com/protocolbuffers/protobuf/releases/tag/v32.0-rc2
krickert commentedon Aug 16, 2025
Wanted to add to this thread.. I just added 4.x to my project and enforced it and it worked on the first shot!!! It's totally working and rockin'.. Been a long time comin.. I still have a lot of tests to do so YMMV
ejona86 commentedon Oct 20, 2025
Protobuf 4.33.0 supports all protobuf 3.x generated code: https://github.com/protocolbuffers/protobuf/releases/tag/v33.0
Do read the release notes, as it mentions how it handles vulnerabilities that exist in older generated code. Note that you still should not use
GeneratedMessageorGeneratedMessageV3in your code; useMessageinstead.I'm discussing with others when to upgrade. It seems it might happen soon. The largest source of remaining breakage is probably people using GeneratedMessageV3.