Hello,

I have been using protobuf successfully for my project for a number of
months now when I compile my project in gcc.  Recently I went to
compile my project in gcc with the -O optimization flag, but when
running the project, I soon get an error when attempting to call
SerializeAsString():

libprotobuf FATAL google/protobuf/message_lite.cc:65] CHECK failed:
(bytes_produced_by_serialization) == (byte_size_before_serialization):
Byte size calculation and serialization were inconsistent.  This may
indicate a bug in protocol buffers or it may be caused by concurrent
modification of the message.
terminate called after throwing an instance of
'google::protobuf::FatalException'
  what():  CHECK failed: (bytes_produced_by_serialization) ==
(byte_size_before_serialization): Byte size calculation and
serialization were inconsistent.  This may indicate a bug in protocol
buffers or it may be caused by concurrent modification of the message.

Please note the project is single-threaded, so I am unsure how
concurrent modification would be possible.

Does anyone know how I might resolve this?  I'm kinda lost on this
error, so any help would be much appreciated.

Thank you,
Robby

-------------------------------------------------------------------------------
Details:

Protobuf version: getting this in both 2.4.0 and 2.4.1

GCC version:
htmud@archive:~/testsvn$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian
4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --
enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-
suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-
id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --
libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-
debug --enable-objc-gc --with-arch-32=i586 --with-tune=generic --
enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-
gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)

Core dump:
Core was generated by `./HTMudServ'.
Program terminated with signal 6, Aborted.
#0  0x00002b5698bfb1b5 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00002b5698bfb1b5 in raise () from /lib/libc.so.6
#1  0x00002b5698bfdfc0 in abort () from /lib/libc.so.6
#2  0x00002b56984e8dc5 in __gnu_cxx::__verbose_terminate_handler() ()
from /usr/lib/libstdc++.so.6
#3  0x00002b56984e7166 in ?? () from /usr/lib/libstdc++.so.6
#4  0x00002b56984e7193 in std::terminate() () from /usr/lib/libstdc+
+.so.6
#5  0x00002b56984e728e in __cxa_throw () from /usr/lib/libstdc++.so.6
#6  0x00002b569817d9db in
google::protobuf::internal::LogMessage::Finish (this=0x7fff7434ae10)
at google/protobuf/stubs/common.cc:195
#7  0x00002b5698185d73 in ByteSizeConsistencyError
(byte_size_before_serialization=<value optimized out>,
byte_size_after_serialization=<value optimized out>,
bytes_produced_by_serialization=46)
    at google/protobuf/message_lite.cc:68
#8  0x00002b5698186098 in
google::protobuf::MessageLite::AppendPartialToString
(this=0x7fff7434aee0, output=<value optimized out>) at google/protobuf/
message_lite.cc:284
#9  0x00002b56981865f1 in
google::protobuf::MessageLite::SerializeAsString (this=0x430f) at
google/protobuf/message_lite.cc:321
#10 0x0000000000426ce4 in CObject::sendItemToPlayer(int, CPlayer*) ()
#11 0x000000000042145b in CPlayer::sendItemToPlayer(int, CPlayer*) ()
#12 0x0000000000421a90 in CPlayer::teleportToLocation(int, WorldPos)
()
#13 0x000000000041002f in HandleIncomingMessage(char*, int, int, int)
()
#14 0x000000000040bfbf in main ()

And here is my code from frame #10
HTMud::EnvAdd item;
item.set_id(ID);
item.set_idtype(typeID);
item.set_x(X);
item.set_y(Y);
item.set_z(Z);
item.set_lockdown(lockdown);
item.set_mapid(map);
item.set_tilesetno(tilesetNo);
item.set_tilesetx(tilesetX);
item.set_regionx(regionX);
item.set_regiony(regionZ);

if (volume == VOL_SELF)
        objects->SendPlrPacket(toWhom, volume, item.SerializeAsString(), 10);

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to