jchavanton/voip_patrol

config->tests_with_rtp_stats.erase crash

jchavanton opened this issue · 1 comments

crash RTP stats

Thread 1 "voip_patrol" received signal SIGSEGV, Segmentation fault.
__memmove_ssse3 () at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:2818
2818    ../sysdeps/x86_64/multiarch/memcpy-ssse3.S: No such file or directory.
(gdb) bt
#0  __memmove_ssse3 () at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:2818
#1  0x0000000000460dc9 in std::__copy_move<true, true, std::random_access_iterator_tag>::__copy_m<Test*> (__first=0x7fffe8069520, __last=0x7fffe8069518, 
    __result=0x7fffe8069518) at /usr/include/c++/5/bits/stl_algobase.h:384
#2  0x0000000000460cd4 in std::__copy_move_a<true, Test**, Test**> (__first=0x7fffe8069520, __last=0x7fffe8069518, __result=0x7fffe8069518)
    at /usr/include/c++/5/bits/stl_algobase.h:402
#3  0x000000000046c544 in std::__copy_move_a2<true, __gnu_cxx::__normal_iterator<Test**, std::vector<Test*, std::allocator<Test*> > >, __gnu_cxx::__normal_iterator<Test**, std::vector<Test*, std::allocator<Test*> > > > (__first=, __last=, __result=) at /usr/include/c++/5/bits/stl_algobase.h:438
#4  0x000000000046bdc3 in std::move<__gnu_cxx::__normal_iterator<Test**, std::vector<Test*, std::allocator<Test*> > >, __gnu_cxx::__normal_iterator<Test**, std::vector<Test*, std::allocator<Test*> > > > (__first=, __last=, __result=) at /usr/include/c++/5/bits/stl_algobase.h:504
#5  0x000000000046b3f5 in std::vector<Test*, std::allocator<Test*> >::_M_erase (this=0x7fffffffe458, __position=) at /usr/include/c++/5/bits/vector.tcc:145
#6  0x000000000046aead in std::vector<Test*, std::allocator<Test*> >::erase (this=0x7fffffffe458, __position=) at /usr/include/c++/5/bits/stl_vector.h:1147
#7  0x000000000046a067 in Action::do_wait (this=0x7fffffffe140, params=std::vector of length 2, capacity 2 = {...}) at /git/voip_patrol/src/voip_patrol/action.cc:549
#8  0x0000000000454e6c in Config::process (this=0x7fffffffe060, p_configFileName="xml/udp_server.xml", p_jsonResultFileName="results.json")
    at /git/voip_patrol/src/voip_patrol/voip_patrol.cc:677
#9  0x0000000000456e04 in main (argc=5, argv=0x7fffffffe598) at /git/voip_patrol/src/voip_patrol/voip_patrol.cc:948
(gdb) frame 7
#7  0x000000000046a067 in Action::do_wait (this=0x7fffffffe140, params=std::vector of length 2, capacity 2 = {...}) at /git/voip_patrol/src/voip_patrol/action.cc:549
549                                     config->tests_with_rtp_stats.erase(config->tests_with_rtp_stats.begin()+pos);
(gdb) p config->tests_with_rtp_stats
$1 = std::vector of length 1, capacity 2 = {0x7fffe808e150}
(gdb) p &config->tests_with_rtp_stats
$2 = (std::vector<Test*, std::allocator<Test*> > *) 0x7fffffffe458
(gdb) p config->tests_with_rtp_stats
$3 = std::vector of length 1, capacity 2 = {0x7fffe808e150}
(gdb) l
544
545                     int pos=0;
546                     for (auto test : config->tests_with_rtp_stats) {
547                             if (test->rtp_stats_ready) {
548                                     test->update_result();
549                                     config->tests_with_rtp_stats.erase(config->tests_with_rtp_stats.begin()+pos);
550                                     LOG(logINFO) << __FUNCTION__ << " erase pos:" << pos;
551                                     pos++;
552                             }
553                     }
(gdb) 

When the first element is erased from a list the begin reference changes to the next one.