I am talking about C++ implementation for python. We should add more checks for MergeFromString() in message.cc <https://github.com/google/protobuf/blob/master/python/google/protobuf/pyext/message.cc#L1936>. I have a change in internal code, however it was blocked by another team because they have a lot of corrupted data which haven't fix yet
On Thu, Jun 9, 2016 at 12:41 PM, <[email protected]> wrote: > Hi Jie Luo, > > Could you explain a little more which C++ code you are talking about - one > that creates message > (that is later parsed in Python) or something else? > > If so, could you provide your changes? > > Thanks, > Vladimir > > On Tuesday, March 15, 2016 at 12:42:53 PM UTC-7, Jie Luo wrote: >> >> It checks the end group tag 4 which should be deprecated. >> >> https://developers.google.com/protocol-buffers/docs/encoding#structure >> >> On Mon, Mar 14, 2016 at 6:41 PM, Lim Wei Chiang <[email protected]> >> wrote: >> >>> Hi Jie Luo, >>> >>> What does the error denote, what should I be checking for? >>> >>> The link you sent has a typo I believe. >>> >>> Thanks for any advice. >>> >>> >>> On Tuesday, 15 March 2016, Jie Luo <[email protected]> wrote: >>> >>>> We are going to change the c++ implementation to the same behavior >>>> with pure python which will raise 'Unexpected end-group tag.' too. >>>> Please see http://b/27494216 >>>> >>>> On Sat, Mar 12, 2016 at 11:46 PM, Wei Chiang Lim <[email protected]> >>>> wrote: >>>> > Hi all >>>> > >>>> > I'm trying parse protobuf messages subscribed from a zeromq feed using >>>> > Python. Intermittently when I parse the message string, my script >>>> crashes >>>> > with the following error >>>> > >>>> > File "ale-feed-location-reader.py", line 37, in <module> >>>> > >>>> > aleEvent.ParseFromString(recvMsg) >>>> > >>>> > File "/usr/lib/python2.7/dist-packages/google/protobuf/message.py", >>>> line >>>> > 182, in ParseFromString >>>> > >>>> > self.MergeFromString(serialized) >>>> > >>>> > File >>>> > >>>> "/usr/lib/python2.7/dist-packages/google/protobuf/internal/python_message.py", >>>> > line 798, in MergeFromString >>>> > >>>> > raise message_mod.DecodeError('Unexpected end-group tag.') >>>> > >>>> > google.protobuf.message.DecodeError: Unexpected end-group tag. >>>> > >>>> > >>>> > My script looks like the following, seems fairly simple enough. Has >>>> anyone >>>> > seen this before, and how would you fix this? My guess is that it is >>>> not any >>>> > corruption on the message from the zmq server, as a vendor provided >>>> c++ >>>> > compiled program is able to parse the messages without any problem. >>>> > >>>> > ----------snip---------- >>>> > # Socket to talk to server >>>> > context = zmq.Context() >>>> > clientSock = context.socket(zmq.SUB) >>>> > clientSock.connect ("tcp://%s:%s" % (serverAddr, serverPort)) >>>> > print('Connected to {0} at port {1}'.format(serverAddr, serverPort)) >>>> > >>>> > topicfilter = "" >>>> > clientSock.setsockopt(zmq.SUBSCRIBE, topicfilter) >>>> > >>>> > while(1): >>>> > # Receive Message >>>> > recvMsg = ''.join(clientSock.recv_multipart()) >>>> > # Parse Message >>>> > aleEvent = schema_pb2.nb_event() >>>> > aleEvent.ParseFromString(recvMsg) >>>> > if aleEvent.IsInitialized(): >>>> > time = datetime.datetime.fromtimestamp(aleEvent.timestamp) >>>> > ----------snip---------- >>>> > >>>> > Thanks for any insight! >>>> > >>>> > -- >>>> > You received this message because you are subscribed to the Google >>>> Groups >>>> > "Protocol Buffers" 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/protobuf. >>>> > For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> -- >>> Sent from a mobile phone >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" 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/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" 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/protobuf. For more options, visit https://groups.google.com/d/optout.
