It's fine to put protobuf messages in STL containers, so if you're seeing
segfaults then those must be caused by some other issue.

On Mon, Jul 12, 2021 at 5:02 AM jobroe <jobro0...@gmail.com> wrote:

>
> Hi,
>
> is it safe to use a STL container of messages ?
>
> I'm doing it and I seeing rare segmentation faults when executed on our
> target platform which is a NXP IMX6ull.
>
> The message queue:
>
> std::queue<gap::fibsctl::ReqSetProcessData> reqs_;
>
>
> a coredump backtrace:
>
> (gdb) bt full
> #0  __libc_do_syscall () at libc-do-syscall.S:49
> No locals.
> #1  0x7695d674 in __libc_signal_restore_set (set=0x74ffe228) at
> ../sysdeps/unix/sysv/linux/internal-signals.h:86
>         _a2tmp = 1962926632
>         _a2 = 1962926632
>         _nametmp = 175
>         _a3tmp = 0
>         _a3 = 0
>         _a1 = 0
>         _a4tmp = 8
>         _a1tmp = 2
>         _a4 = 8
>         _name = 175
> #2  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:48
>         set = {__val = {512, 0, 1987579284, 1987314847, 6096896,
> 4294967295, 0, 534576640, 0, 4294967295, 1990345404, 0, 6323000, 256,
> 1962926780, 1962926820, 256, 1962926820, 1987945800, 1962926760, 2, 2,
> 6344464, 1987914820, 1962926820, 1987945800, 5852160,
>             1987823481, 6344465, 1987835675, 1962927240, 1989531621}}
>         pid = <optimized out>
>         tid = <optimized out>
>         ret = <optimized out>
> #3  0x7694eba2 in __GI_abort () at abort.c:79
>         save_stage = 1
>         act = {__sigaction_handler = {sa_handler = 0x60764c, sa_sigaction
> = 0x60764c}, sa_mask = {__val = {6324920, 1962927144, 1962927088, 0,
> 6321736, 534576640, 1962927088, 0, 1962927150, 1962927348, 1994068248, 1,
> 1962927148, 1962927300, 1962927356, 1992787793,
>               1990345404, 1962927308, 1962927308, 2, 0, 1962927150,
> 1962927150, 0, 16, 5592568, 1990345404, 17, 1991824636, 1991442331,
> 1991442245, 1962927240}}, sa_flags = 1989984679, sa_restorer = 0x1000}
>         sigs = {__val = {32, 0 <repeats 31 times>}}
> #4  0x76984b6c in __libc_message (action=action@entry=do_abort,
> fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:155
>         ap = {__ap = 0x74ffe4c4}
>         fd = <optimized out>
>         list = <optimized out>
>         nlist = <optimized out>
>         cp = <optimized out>
> #5  0x7698997a in malloc_printerr (str=<optimized out>) at malloc.c:5347
> No locals.
> #6  0x7698af42 in _int_free (av=0x76a24a1c <main_arena>, p=0x607d70,
> have_lock=0) at malloc.c:4201
>         tmp = <optimized out>
>         e = 0x607d78
>         tc_idx = 2
>         size = 32
>         fb = <optimized out>
>         nextchunk = <optimized out>
>         nextsize = <optimized out>
>         nextinuse = <optimized out>
>         prevsize = <optimized out>
>         bck = 0x607790
>         fwd = <optimized out>
>         __PRETTY_FUNCTION__ = "_int_free"
> #7  0x76dd6fec in gap::fibsctl::ProcessData::~ProcessData (this=0x607d78,
> __in_chrg=<optimized out>) at src/fibsctl.pb.cc:1733
> No locals.
> #8  0x76dd7044 in gap::fibsctl::ReqSetProcessData::SharedDtor
> (this=<optimized out>) at src/fibsctl.pb.cc:1941
> No locals.
> #9  gap::fibsctl::ReqSetProcessData::~ReqSetProcessData (this=<optimized
> out>, __in_chrg=<optimized out>) at src/fibsctl.pb.cc:1935
> No locals.
> #10 gap::fibsctl::ReqSetProcessData::~ReqSetProcessData (this=0x60cc90,
> __in_chrg=<optimized out>) at src/fibsctl.pb.cc:1932
> No locals.
> #11 0x00432360 in
> __gnu_cxx::new_allocator<gap::fibsctl::ReqSetProcessData>::destroy<gap::fibsctl::ReqSetProcessData>
> (this=0x7e931c08, __p=<optimized out>) at
> /usr/include/c++/9.3.0/ext/new_allocator.h:151
> No locals.
> #12 std::allocator_traits<std::allocator<gap::fibsctl::ReqSetProcessData>
> >::destroy<gap::fibsctl::ReqSetProcessData> (__a=..., __p=<optimized out>)
> at /usr/include/c++/9.3.0/bits/alloc_traits.h:497
> No locals.
> #13 std::deque<gap::fibsctl::ReqSetProcessData,
> std::allocator<gap::fibsctl::ReqSetProcessData> >::pop_front
> (this=0x7e931c08) at /usr/include/c++/9.3.0/bits/stl_deque.h:1611
> No locals.
> #14 std::queue<gap::fibsctl::ReqSetProcessData,
> std::deque<gap::fibsctl::ReqSetProcessData,
> std::allocator<gap::fibsctl::ReqSetProcessData> > >::pop (this=0x7e931c08)
> at /usr/include/c++/9.3.0/bits/stl_queue.h:295
> No locals.
> #15 CopsMdpPeer::RequestWorker (this=0x7e931be0) at
> /usr/src/debug/copsman/0.1.0-gitAUTOINC+41c1ea61bc-r0/git/src/copsmdppeer.cpp:74
>         lk = {_M_device = 0x7e931c34, _M_owns = true}
>         req = {<google::protobuf::Message> =
> {<google::protobuf::MessageLite> = {_vptr.MessageLite = 0x76debaa0 <vtable
> for gap::fibsctl::ReqSetProcessData+8>, _internal_metadata_ = {ptr_ = 0,
> static kUnknownFieldsTagMask = 1, static kMessageOwnedArenaTagMask = 2,
>                 static kPtrTagMask = 3, static kPtrValueMask = -4}}, <No
> data fields>}, static kIndexInFileMessages = 7, static _class_data_ = {
>             copy_to_from = 0x76cfa435
> <google::protobuf::Message::CopyWithSizeCheck(google::protobuf::Message*,
> google::protobuf::Message const&)>,
>             merge_to_from = 0x76dd8ef1
> <gap::fibsctl::ReqSetProcessData::MergeImpl(google::protobuf::Message*,
> google::protobuf::Message const&)>}, process_data_ = 0x6079c8,
> _cached_size_ = {size_ = {<std::__atomic_base<int>> = {static _S_alignment
> = 4,
> --Type <RET> for more, q to quit, c to continue without paging--
>                 _M_i = 0}, <No data fields>}}}
> #16 0x76ae9b42 in std::execute_native_thread_routine (__p=0x594be8) at
> ../../../../../../../../../../work-shared/gcc-9.3.0-r0/gcc-9.3.0/libstdc++-v3/src/c++11/thread.cc:80
>         __t = {_M_t = {
>             _M_t = {<std::_Tuple_impl<0, std::thread::_State*,
> std::default_delete<std::thread::_State> >> = {<std::_Tuple_impl<1,
> std::default_delete<std::thread::_State> >> = {<std::_Head_base<1,
> std::default_delete<std::thread::_State>, true>> =
> {<std::default_delete<std::thread::_State>> = {<No data fields>}, <No data
> fields>}, <No data fields>}, <std::_Head_base<0, std::thread::_State*,
> false>> = {_M_head_impl = 0x594be8}, <No data fields>}, <No data fields>}}}
> #17 0x76b97988 in start_thread (arg=0xf1a37314) at pthread_create.c:477
>         ret = <optimized out>
>         start = <optimized out>
>         pd = 0xf1a37314
>         unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-203034643,
> -240946412, 1962929024, 2123569600 <(212)%20356-9600>, 3, 1962927512,
> 1962929024, 1962929136, 0, 2123569600 <(212)%20356-9600>, 0 <repeats 54
> times>}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data =
> {prev = 0x0,
>               cleanup = 0x0, canceltype = 0}}}
>         not_first_call = <optimized out>
>         robust = <optimized out>
> #18 0x769ce3dc in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from
> ./lib/libc.so.6
> No locals.
> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
> (gdb)
>
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/13c0cc31-2500-4a85-b5b9-2722020cdb04n%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/13c0cc31-2500-4a85-b5b9-2722020cdb04n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr5yDiLvNr0UG%3D0RgnzAs0xVAKO1R5ZXJHjUhRMbJRmZcQ%40mail.gmail.com.

Reply via email to