The error you see is correct. In proto, you can't reuse field numbers or modify their type. You'll need to use field id "2" instead. Generally, you'll need to set both fields until all the old clients have been upgraded, and then remove field "1".
On Wednesday, March 7, 2018 at 11:55:04 AM UTC-8, [email protected] wrote: > > Hello, > I was working on a grpc server based project, I have a proto which has > updated through different versions. As I was testing my server from > different aspect. It was evident that when a call is made on server from a > older version of proto, server throws error: > > Mar 08, 2018 12:57:49 AM io.grpc.internal.SerializingExecutor run > SEVERE: Exception while executing runnable > io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1@4e158ee6 > io.grpc.StatusRuntimeException: INTERNAL: Invalid protobuf byte sequence > at io.grpc.Status.asRuntimeException(Status.java:517) > at io.grpc.protobuf.lite.ProtoLiteUtils$2.parse(ProtoLiteUtils.java:165) > at io.grpc.protobuf.lite.ProtoLiteUtils$2.parse(ProtoLiteUtils.java:79) > at io.grpc.MethodDescriptor.parseRequest(MethodDescriptor.java:280) > at > io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.messagesAvailable(ServerCallImpl.java:252) > at > io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1.runInContext(ServerImpl.java:576) > at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) > at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:102) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > Caused by: com.google.protobuf.InvalidProtocolBufferException: Protocol > message end-group tag did not match expected tag. > at > com.google.protobuf.InvalidProtocolBufferException.invalidEndTag(InvalidProtocolBufferException.java:106) > at > com.google.protobuf.CodedInputStream$ArrayDecoder.checkLastTagWas(CodedInputStream.java:559) > at > com.google.protobuf.CodedInputStream$ArrayDecoder.readMessage(CodedInputStream.java:817) > at com.mediaiq.caps.platform.Event.<init>(Event.java:57) > at com.mediaiq.caps.platform.Event.<init>(Event.java:9) > at com.mediaiq.caps.platform.Event$1.parsePartialFrom(Event.java:849) > at com.mediaiq.caps.platform.Event$1.parsePartialFrom(Event.java:844) > at > com.google.protobuf.CodedInputStream$ArrayDecoder.readMessage(CodedInputStream.java:816) > at com.mediaiq.caps.platform.PublishRequest.<init>(PublishRequest.java:57) > at com.mediaiq.caps.platform.PublishRequest.<init>(PublishRequest.java:9) > at > com.mediaiq.caps.platform.PublishRequest$1.parsePartialFrom(PublishRequest.java:668) > at > com.mediaiq.caps.platform.PublishRequest$1.parsePartialFrom(PublishRequest.java:663) > at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:91) > at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49) > at > io.grpc.protobuf.lite.ProtoLiteUtils$2.parseFrom(ProtoLiteUtils.java:170) > at io.grpc.protobuf.lite.ProtoLiteUtils$2.parse(ProtoLiteUtils.java:162) > ... 9 more > > While the client gets error > io.grpc.StatusRuntimeException: UNKNOWN > > I want the client side error to be more descriptive as why the call failed > and what proto to use .I tried interceptor for catching the error, but the > error does not get catch by interceptor. Is there any way to catch this > error and modify the error for proper error handling. > > PS. The Sample two proto verions are > Version 1.0: > service EchoService { > rpc Echo(SimpleMessage) returns (SimpleMessage) {} > } > > message SimpleMessage { > string id = 1; > } > > Version 2.0: > service EchoService { > rpc Echo(SimpleMessage) returns (SimpleMessage) {} > } > > message SimpleMessage { > int64 id = 1; > } > > > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/196556a8-c8ee-401a-8494-6e03f2c07af1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
