public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "laurent.alfonsi at st dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/52604] New: mt allocator crashes on multi-threaded Date: Fri, 16 Mar 2012 15:25:00 -0000 [thread overview] Message-ID: <bug-52604-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52604 Bug #: 52604 Summary: mt allocator crashes on multi-threaded Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: laurent.alfonsi@st.com Created attachment 26904 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26904 Testcase to reproduce There's a problem with mt_allocator when using multi-threads. see example attached (g++ -lpthread). At exit time, - the __freelist destructor is called. which does a __gthread_key_delete(_M_key). - and then afterwards, the std::list<> destructor is called. This finally have for effect to use that thread key with gthread_setspecific. Valgrind reports : ================================= ==5212== Invalid read of size 8 ==5212== at 0x4CA009D: __gnu_cxx::__pool<true>::_M_get_thread_id() (in ../gcc-4.6.3/lib64/libstdc++.so.6.0.16) ==5212== by 0x4CA0173: __gnu_cxx::__pool<true>::_M_reclaim_block(char*, unsigned long) (in ../gcc-4.6.3/lib64/libstdc++.so.6.0.16) ==5212== by 0x401989: __gnu_cxx::__mt_alloc<std::_List_node<std::string>, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate(std::_List_node<std::string>*, unsigned long) (in /tmp/a.out) ==5212== by 0x401847: std::_List_base<std::string, __gnu_cxx::__mt_alloc<std::string, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_put_node(std::_List_node<std::string>*) (in /tmp/a.out) ==5212== by 0x40168C: std::_List_base<std::string, __gnu_cxx::__mt_alloc<std::string, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_clear() (in /tmp/a.out) ==5212== by 0x40151A: std::_List_base<std::string, __gnu_cxx::__mt_alloc<std::string, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::~_List_base() (in /tmp/a.out) ==5212== by 0x401BB1: std::list<std::string, __gnu_cxx::__mt_alloc<std::string, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::~list() (in /tmp/a.out) ==5212== by 0x3814E30C94: exit (in /lib64/tls/libc-2.3.4.so) ==5212== by 0x3814E1C411: (below main) (in /lib64/tls/libc-2.3.4.so) ==5212== Address 0x5b5ce88 is 24 bytes inside a block of size 65,536 free'd ==5212== at 0x4A077EC: operator delete(void*) (vg_replace_malloc.c:457) ==5212== by 0x3814E30C94: exit (in /lib64/tls/libc-2.3.4.so) ==5212== by 0x3814E1C411: (below main) (in /lib64/tls/libc-2.3.4.so) ================================= I ve seen a quite close bug report (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22309), that is already fixed in 4.0.0. This apparently leaded to re-write a part of mt_allocate (Jakub Jelinek). But this was not sufficient for the current bug report i m reporting. Thanks in advance. Laurent Alfonsi
next reply other threads:[~2012-03-16 15:24 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-16 15:25 laurent.alfonsi at st dot com [this message] 2012-03-16 15:32 ` [Bug libstdc++/52604] " laurent.alfonsi at st dot com 2012-03-19 13:04 ` paolo.carlini at oracle dot com 2012-03-20 12:34 ` laurent.alfonsi at st dot com 2012-03-20 12:56 ` paolo.carlini at oracle dot com 2012-03-20 14:05 ` jakub at gcc dot gnu.org 2012-03-23 11:11 ` laurent.alfonsi at st dot com 2012-04-10 15:28 ` laurent.alfonsi at st dot com 2012-04-11 1:08 ` paolo.carlini at oracle dot com 2012-04-12 15:05 ` laurent.alfonsi at st dot com 2012-04-12 15:37 ` paolo.carlini at oracle dot com 2012-04-12 16:30 ` paolo.carlini at oracle dot com 2012-04-12 21:56 ` laurent.alfonsi at st dot com 2012-04-12 23:02 ` paolo.carlini at oracle dot com 2012-04-13 9:46 ` laurent.alfonsi at st dot com 2012-04-13 9:49 ` redi at gcc dot gnu.org 2012-04-13 10:29 ` paolo.carlini at oracle dot com 2012-04-13 10:31 ` paolo.carlini at oracle dot com 2012-04-13 12:01 ` laurent.alfonsi at st dot com 2012-04-13 12:02 ` laurent.alfonsi at st dot com 2012-04-13 14:46 ` paolo.carlini at oracle dot com 2012-04-17 13:19 ` chrbr at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-52604-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).