2013-07-27 136 views
15

我只是在調試一個大的項目,並與收到此錯誤損壞的雙鏈表?

*** glibc detected *** p_appmanager/obj/appmanager: corrupted double-linked list: 0x08325e18 ** 

我試圖調試用Valgrind的代碼,但我沒有太多熟悉的工具。所以我在這裏傾銷日誌,如果你能找到他們的任何東西,請讓我知道。

任何人都可以解釋下面的錯誤信息可能意味着什麼?

==2181== Invalid read of size 1 
==2181== at 0x402C658: strlen (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x40FCC2D: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x4359234 is 12 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 1 
==2181== at 0x402C663: strlen (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x40FCC2D: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x4359235 is 13 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 4 
==2181== at 0x402DA08: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4106850: std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40D8CDF: std::basic_filebuf<char, std::char_traits<char> >::xsputn(char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40FC9AA: std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40FCC3D: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x4359234 is 12 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 2 
==2181== at 0x402DA60: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4106850: std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40D8CDF: std::basic_filebuf<char, std::char_traits<char> >::xsputn(char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40FC9AA: std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40FCC3D: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x4359238 is 16 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 1 
==2181== at 0x402DA90: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4106850: std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40D8CDF: std::basic_filebuf<char, std::char_traits<char> >::xsputn(char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40FC9AA: std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40FCC3D: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x435923a is 18 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 1 
==2181== at 0x402DA9C: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4106850: std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40D8CDF: std::basic_filebuf<char, std::char_traits<char> >::xsputn(char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40FC9AA: std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x40FCC3D: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x43f0936 is 14 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
stop tablet 
==2181== Invalid read of size 1 
==2181== at 0x402C658: strlen (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4108EF1: std::string::operator=(char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x45b2e14 is 12 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 1 
==2181== at 0x402C663: strlen (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4108EF1: std::string::operator=(char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x45b2e15 is 13 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 1 
==2181== at 0x402DAEA: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4108C7A: std::string::_M_replace_safe(unsigned int, unsigned int, char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4108CF8: std::string::assign(char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4108F05: std::string::operator=(char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x45b2e19 is 17 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 4 
==2181== at 0x402DB18: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4108C7A: std::string::_M_replace_safe(unsigned int, unsigned int, char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4108CF8: std::string::assign(char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4108F05: std::string::operator=(char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x45b2e14 is 12 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
Success:: tablet process terminated Successfully. 
CONSOLE>start tablet 
Success:: tablet Process Created Successfully 
CONSOLE>stop tablet 
==2181== Invalid read of size 4 
==2181== at 0x402DA08: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4108C7A: std::string::_M_replace_safe(unsigned int, unsigned int, char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4108CF8: std::string::assign(char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4108F05: std::string::operator=(char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x45dd8c4 is 12 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 
==2181== Invalid read of size 2 
==2181== at 0x402DA60: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x4108C7A: std::string::_M_replace_safe(unsigned int, unsigned int, char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4108CF8: std::string::assign(char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4108F05: std::string::operator=(char const*) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== Address 0x45dd8c8 is 16 bytes inside a block of size 21 free'd 
==2181== at 0x402ACFC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) 
==2181== by 0x410899A: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16) 
==2181== by 0x4071B37: void std::_Destroy_aux<false>::__destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x40717DC: void std::_Destroy<std::string*>(std::string*, std::string*) (in /usr/lib/libparser.so) 
==2181== by 0x4071041: void std::_Destroy<std::string*, std::string>(std::string*, std::string*, std::allocator<std::string>&) (in /usr/lib/libparser.so) 
==2181== by 0x407088A: std::vector<std::string, std::allocator<std::string> >::~vector() (in /usr/lib/libparser.so) 
==2181== by 0x406F497: Parser::parse(std::string) (in /usr/lib/libparser.so) 
==2181== by 0x40729E2: getMessage(int, Message**) (in /usr/lib/libparser.so) 
==2181== by 0x804CB99: fifoThread(void*) (in /home/cleanhands/SBISSW (2)/p_appmanager/obj/appmanager) 
==2181== by 0x4054D4B: start_thread (pthread_create.c:308) 
==2181== by 0x4269DDD: clone (clone.S:130) 
==2181== 

回答

24

它看起來像一個線程是已被釋放的主要(或其他)線程打印數據(char*字符數據)。

更具體地說,Parser::parse構建了std::stringvector s。


編輯正如評論的要求,這是我看不懂,用[highlights]

==2181==[Invalid read of size 1]
==2181==at 0x402C658: strlen (in /usr/lib/valgrind/vg...
==2181==by 0x40FCC2D: std::basic_ostream<char, std::c...
==2181==by 0x4054D4B: start_thread (pthread_create.c:...
==2181==by 0x4269DDD: clone (clone.S:130)
==2181==[Address 0x4359234]is 12 bytes inside[a block of size 21 free'd]
==2181==at 0x402ACFC: operator delete(void*) (in /usr...
==2181==by 0x410899A: std::string::_Rep::_M_destroy(s...
==2181==by 0x4071B37: void std::_Destroy_aux<false>::...
==2181==by 0x40717DC: void std::_Destroy<std::string*...
==2181==by 0x4071041: void std::_Destroy<std::string*...
==2181== by 0x407088A: std::vector<std::string, std::a... [::~vector()](in /usr/lib/libparser.so
==2181== by 0x406F497:[Parser::parse(std::string)](in /usr/lib/libparser.so
==2181==by 0x40729E2: getMessage(int, Message**) (in ...
==2181==by 0x804CB99: fifoThread(void*) (in /home/cle...
==2181==by 0x4054D4B: start_thread (pthread_create.c:...
==2181==by 0x4269DDD: clone (clone.S:130

而我注意到其他backtracecs都突出了相同的模式。


顯然,一些線程開始,並且它們被傳遞給這些字符串的引用(in)。但是,由於矢量是Parser::parse(可能是一個自動變量,或明確刪除)的本地矢量,所以這些引用不再有效(例如,在使用std::ostream::operator<<(std::ostream&, const char*)串流時)的引用不再有效()。

可悲的是,堆棧跟蹤並不完全顯示什麼名稱/對象模塊包含有問題的行,但你可以看到它活在一個單獨的線程(由於start_thread存在)

編輯顯然,線程取參考string(來自向量),因爲線程是試圖將字符串分配給另一個string

這可能表示程序員已經意識到refence不可靠並嘗試將其複製到線程局部變量的事實。也許只是涉及競賽狀況,並且string甚至沒有足夠長的時間讓本地副本工作。

IOW。這樣看來,一個線程正在啓​​動這樣:

#include <future> 
#include <algorithm> 
#include <sstream> 
#include <iterator> 
#include <iostream> 

using namespace std; 

// sample: return the largest integer value or 42 
int some_background_worker(vector<string> const& ref_data) 
{ 
    if (ref_data.empty()) return 42; 

    vector<int> values(ref_data.size()); 
    transform(begin(ref_data), end(ref_data), begin(values), 
      [](string const& s) { return stoi(s); }); 
    return *max_element(begin(values), end(values)); 
} 

struct Parser 
{ 
    future<int> parse(string const& msg) const 
    { 
     istringstream iss(msg); 
     istream_iterator<string> f(iss), l; 

     const vector<string> data { f, l }; 

     // now dispatch a thread to do the work 
     return async(some_background_worker, ref(data)); 
    } 
}; 

int main() // mimicks your "fifoThread" function 
{ 
    // we use a simple vector to stub your fifo queue: 
    const std::vector<string> fifoQueue { "1 3 9 -1 2", "32389 3102 -34 -888", "-42 -889", "" }; 

    vector<future<int>> results; 

    { 
     Parser parser; 
     for(auto& msg : fifoQueue) 
      results.push_back(parser.parse(msg)); 
    } 

    // all parser data has been throroughly destroyed, before we might even 
    // start the workers 
    for(auto& fut: results) 
     std::cout << "result of worker: " << fut.get() << "\n"; 
} 

這裏,同樣的競爭條件發生時,作爲參考,以「即將成爲陳舊的」數據傳遞給線程:

async(some_background_worker, ref(data)); 

它與我的系統上的bad_alloc崩潰(這是假的,但完美的未定義行爲)。

就像我上面所說的,的std :: string ::分配通話可能表明線程試圖複製本地數據,如:

vector<string> local_copy(ref_data); 

,但將仍然數據競賽,因爲(沒有明確的同步),即使在這一點上也不能保證ref_data有效。


修復它通過移動數據到線程,而不是:現在

int some_background_worker(vector<string> data); 

// and then, in parse(...): 
    async(some_background_worker, std::move(data)); 

,我的系統上,它運行並打印

result of worker: 9 
result of worker: 32389 
result of worker: -42 
result of worker: 42 

完全符合市場預期。看到它正在運行live at Coliru

+2

非常感謝。你已經確定了發生腐敗的確切位置。 「更具體地說,Parser :: parse構建了一個std :: strings的向量。」 –

+0

但是你說什麼,我的意思是你可以選擇這些消息給我,這樣下次我不需要你的幫助。 –

+2

@AmitBhaira我編輯了答案,顯示了我如何閱讀回溯,並用*** ['highlights'] ***顯示了觸發我分析的內容。所以,公平地說,這是Valgrind指出的腐敗來源:) – sehe