I think Marc is right that it would be best to isolate the problem by
manually checking that the bytes are valid.

Tony, how are you framing the messages? Protocol buffers do not describe
their own size and so you have to know what size to expect before you parse
a proto. The typical approach is to frame the serialized messages by
prefixing them with their size. It's easy to get this wrong, though, so
that could potentially be the reason that the messages aren't showing up as
you expect.

On Tue, Apr 10, 2018 at 7:28 AM Marc Gravell <marc.grav...@gmail.com> wrote:

> Well, if it was me: the first thing I'd do is isolate whether it is
> serialize or deserialize that is failing - by taking your currently
> serialized data as a flat file or byte dump, and checking whether the
> values are right or wrong.
>
> Depending on the volume and layout of the data, you might be able to use
> protoc's inbuilt decode mechanisms, or (as long as it isn't huge) you're
> welcome to try using https://protogen.marcgravell.com/decode
>
> That would allow you to focus your checks.
>
> Marc
>
> On 10 April 2018 at 14:20, Tony Tony <xxteknolus...@gmail.com> wrote:
>
>> c++/windows
>>
>> I'll upgrade protobuf and see if issue goes away. Just wanted to make
>> sure I'm not missing anything. Is there any additional troubleshooting I
>> can look into to troubleshoot further if the recent release reproduce the
>> issue?
>>
>> On Tuesday, April 10, 2018 at 1:46:50 AM UTC-4, Marc Gravell wrote:
>>>
>>> First thought: what language / platform is this? the C++ generated code
>>> is very different to the Java generated code, for example
>>>
>>> Second thought: 2.6 is pretty old; it is very possible that a bug
>>> existed and has been fixed since then (Aug 2014) - does it still happen
>>> with more recent releases?
>>>
>>> The scenario you present seems fine and reasonable.
>>>
>>> Marc
>>>
>>> On 10 April 2018 at 03:46, Tony Tony <xxtekn...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have a strange case I'm dealing with. Using protobuf compiler 2.6.
>>>>
>>>> Every time I send a certain set of values over my socket, it ends up
>>>> with missing data. Although I've compared the string received after
>>>> serialization on the server and on receiving the string on the client and
>>>> they are exactly the same, yet the values are all -1.
>>>>
>>>> I've attached a snippet of the proto file below.
>>>>
>>>> At this point these are below combos that always fail
>>>>
>>>> type=99, count= 0, index = 1 (all values are -1 after deserialization)
>>>> type=99, count=99, index= 1 (works)
>>>> type=99999, count=999999, index= 1 (works)
>>>>
>>>> - Basically anytime count is 0, all the values seem to be -1. However
>>>> if I make type 0, the same behavior does not occur. Am I missing something
>>>> or there is some underlying bug in my code? Again I've checked multiple
>>>> times the correct raw string data is being sent (with correct size). I use
>>>> the parseFromString method to parse the receiving string data.
>>>>
>>>> - I've sent plenty of other types of data just fine.
>>>>
>>>> - There are other messages defined in the same protobuf packet
>>>> definition file, can that make a difference?
>>>>
>>>> message packet {
>>>> required int32 type = 1 [default = -1];
>>>> required int32 count = 2 [default = -1];
>>>> required int32 index = 3 [default = -1];
>>>> }
>>>>
>>>> Thanks
>>>>
>>>> --
>>>> 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 protobuf+u...@googlegroups.com.
>>>> To post to this group, send email to prot...@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/protobuf.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>>
>>> Marc
>>>
>> --
>> 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 protobuf+unsubscr...@googlegroups.com.
>> To post to this group, send email to protobuf@googlegroups.com.
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Regards,
>
> Marc
>
> --
> 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 protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> 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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to