What happens if server and client are using different proto definitions?

33 views
Skip to first unread message

tobias.krueger

unread,
Oct 7, 2020, 6:26:21 AM10/7/20
to grpc.io
Hi group,
we just realized, that the server's developing team was using a different proto definition than the client team. Both sides are implementing in C++

e.g. Server is using
message Foo {
    string value = 1;
};

The client is using
message Foo {
    uint32 value = 1;
};

What happens, if the server sends the message containing the string in a stream to the client?
Will the client just read the default value for the uint32 (==0), or will the client become garbage data or even worse - is a crash possible?

Thanks for your help
Tobias

dfa...@google.com

unread,
Oct 7, 2020, 1:19:00 PM10/7/20
to grpc.io
A crash should not occur as a result of a corrupt message (which is how a message with a conflicting encoding appears). 

On the client side, an error (non-OK grpc status) should occur if this field is set by the server.  If a message comes back with a non-OK status, the value read from the message would be the default (0).

Doug
Reply all
Reply to author
Forward
0 new messages