I am running into a weird situation where the length of the data passed in 
the elements leads to a Writetype mismatch message.

Here is snippet for the protobuf:

message QueryResponse
{
    message QueryNode {
        required string node_name = 1;
        required string node_value = 2;
    }
    repeated QueryNode nodes = 3;
}

So this message has repeated elements of two strings.

When I create a response object and set the node_name and node_value such 
that both the strings are small enough, it works flawlessly.

For example, if the length of the node_name string is 87 and that of 
node_value is 36, adding 5 elements to the 'node' and sending it over tcp 
and parsing it over the other side works fine.
However, if the node_name string is 87 chars in length and the node_value 
is 38 (just two more characters), the same test fails with the following 
stack trace:

  File "/work/g..y", line 292, in run_query
    query_resp.ParseFromString(query_nodes)
  File "/.../local/protobuf-python/google/protobuf/message.py", line 159, 
in ParseFromString
    self.MergeFromString(serialized)
  File "/.../local/protobuf-python/google/protobuf/reflection.py", line 
1238, in MergeFromString
    bytes_read = _DeserializeOneEntity(message_descriptor, self, decoder)
  File "/.../local/protobuf-python/google/protobuf/reflection.py", line 
1082, in _DeserializeOneEntity
    raise RuntimeError('TODO(robinson): Wiretype mismatches not handled.')
RuntimeError: TODO(robinson): Wiretype mismatches not handled.

The overall message length is less that 720bytes, Even if i have one 
element in the entire message but if the length of one of the string grows 
by 2, it crashes with this exception.
I could not figure why is this happening. 
Any ideas on how to debug this ? Just changing the lengths causes this to 
fail.
When i dump the message without parsing on screen, i can see the data 
correctly - not sure why the parser keeps failing.
Reducing the length of the node_value type by 2 chars makes everything work 
again...

Any help would be greatly appreciated. 

-- 
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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to