Protobuf: Debugging help - message_lite.h:108 FATAL CHECK

Created on 14 Jun 2019  路  2Comments  路  Source: protocolbuffers/protobuf

I am running a C++ program using libprotobuf version 3.7.1, and getting the following FATAL error:

[libprotobuf FATAL /usr/local/include/google/protobuf/message_lite.h:108] CHECK failed: (size) <= (static_cast<size_t>(0x7fffffff)):

This, unfortunately, only occurs once or twice a week on a system handling 200 - 2000 message per second.

Can anyone provide advice on how to go about debugging this issue?

Does this error indicate an issue with libprotobuf or is the problem likely an issue with a call into the library from my code?

Most helpful comment

Protobuf messages have to be less than 2 GB in size. It looks like you are occasionally hitting that limit with some message. To avoid that crash, I would recommend making sure to always call ByteSizeLong() instead of ByteSize() when you want to determine the serialized size of a message. ByteSize() crashes with that assertion because it returns a signed 32-bit int and therefore can't return a correct answer if the size is 2 GB or higher. ByteSizeLong() will always return the correct answer. You won't be able to serialize the message if it's 2 GB or higher, but you can at least check for that case and handle it without crashing if you call ByteSizeLong().

All 2 comments

Protobuf messages have to be less than 2 GB in size. It looks like you are occasionally hitting that limit with some message. To avoid that crash, I would recommend making sure to always call ByteSizeLong() instead of ByteSize() when you want to determine the serialized size of a message. ByteSize() crashes with that assertion because it returns a signed 32-bit int and therefore can't return a correct answer if the size is 2 GB or higher. ByteSizeLong() will always return the correct answer. You won't be able to serialize the message if it's 2 GB or higher, but you can at least check for that case and handle it without crashing if you call ByteSizeLong().

Thanks @acozzette. I believe this is the help I needed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kolea2 picture kolea2  路  40Comments

MartinDong picture MartinDong  路  49Comments

tang3w picture tang3w  路  39Comments

liujisi picture liujisi  路  48Comments

xfxyjwf picture xfxyjwf  路  35Comments