protobuf DebugString 引起的 异常
引用
参考了 下面两个链接,感谢原作者
https://stackoverflow.com/questions/62213892/protobuf-shortdebugstring-crash
https://github.com/protocolbuffers/protobuf/issues/4958
https://stackoverflow.com/questions/51584960/stdcall-once-throws-stdsystem-error-unknown-error-1
现象
#0 0x00007f9bfc4afb20 in __cxa_throw () from /lib64/libstdc++.so.6
#1 0x00007f9bfc504e30 in std::__throw_system_error(int) () from /lib64/libstdc++.so.6
#2 0x00007f9bf8c29ed2 in call_once<void (&)(google::protobuf::internal::AssignDescriptorsTable const*), google::protobuf::internal::AssignDescriptorsTable*&>
(
__f=@0x7f9bf8c2f960: {void (const google::protobuf::internal::AssignDescriptorsTable *)} 0x7f9bf8c2f960 <google::protobuf::internal::(anonymous namespace)::AssignDescriptorsImpl(google::protobuf::internal::AssignDescriptorsTable const*)>, __once=...) at /usr/include/c++/4.8.2/mutex:794
#3 google::protobuf::internal::AssignDescriptors (table=table@entry=0x7f9bf8a9fbe0 <assign_descriptors_table_crmq_2eproto>)
at google/protobuf/generated_message_reflection.cc:2398
#4 0x00007f9bf86d3ce0 in CrmqProto::GetMetadata (this=<optimized out>) at crmq.pb.cc:18166
#5 0x00007f9bf8c63183 in GetDescriptor (this=this@entry=0xdfcf70) at ./google/protobuf/message.h:356
#6 google::protobuf::TextFormat::Printer::Print (this=this@entry=0xdfc9d0, message=..., generator=generator@entry=0xdfc930)
at google/protobuf/text_format.cc:1939
#7 0x00007f9bf8c6347c in google::protobuf::TextFormat::Printer::Print (this=this@entry=0xdfc9d0, message=..., output=output@entry=0xdfc980)
at google/protobuf/text_format.cc:1852
#8 0x00007f9bf8c6350f in google::protobuf::TextFormat::Printer::PrintToString (this=this@entry=0xdfc9d0, message=..., output=output@entry=0xdfcb20)
at google/protobuf/text_format.cc:1835
#9 0x00007f9bf8c6355f in google::protobuf::Message::DebugString (this=this@entry=0xdfcf70) at google/protobuf/text_format.cc:90
原因 &解决方法
call_once 使用了系统多线程库, 链接和编译时 需要 -pthread
来源:oschina
链接:https://my.oschina.net/u/4358874/blog/4702441