From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29447 invoked by alias); 1 Aug 2005 02:58:16 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 29420 invoked by uid 22791); 1 Aug 2005 02:58:10 -0000 Received: from web51902.mail.yahoo.com (HELO web51902.mail.yahoo.com) (206.190.48.65) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Mon, 01 Aug 2005 02:58:10 +0000 Received: (qmail 23237 invoked by uid 60001); 1 Aug 2005 02:58:09 -0000 Message-ID: <20050801025809.23235.qmail@web51902.mail.yahoo.com> Received: from [202.134.126.179] by web51902.mail.yahoo.com via HTTP; Mon, 01 Aug 2005 10:58:09 CST Date: Mon, 01 Aug 2005 02:58:00 -0000 From: Suet Lung Cheung Subject: std::string:;assign fail in multi-threaded program To: gcc@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=big5 Content-Transfer-Encoding: 8bit X-SW-Source: 2005-08/txt/msg00004.txt.bz2 Hi, First, thx for u all reading this mail. I have some problems when I was using std::string when I was writing my multi-threaded server. I am using libstdc++ 5.0.3. and using pthread to do multi threading. The errors are as the followings. shot 1 #0 0xbfdb3bc6 in std::__default_alloc_template::allocate(unsigned) () from /usr/lib/libstdc++.so.5 (gdb) bt #0 0xbfdb3bc6 in std::__default_alloc_template::allocate(unsigned) () from /usr/lib/libstdc++.so.5 #1 0xbfdb9bf8 in std::string::_Rep::_S_create(unsigned, std::allocator const&) () from /usr/lib/libstdc++.so.5 #2 0xbfdb641d in std::string::_M_mutate(unsigned, unsigned, unsigned) () from /usr/lib/libstdc++.so.5 #3 0x08066f8d in std::string& std::string::_M_replace_safe(__gnu_cxx::__normal_iterator, __gnu_cxx::__normal_iterator, char const*, char const*) (this=0xbd3d6bd0, __k1=0xbf8b3349 "kent", __k2=0xbf8b334d "") at basic_string.tcc:533 #4 0xbfdb6fac in std::string::assign(char const*, unsigned) () from /usr/lib/libstdc++.so.5 snap 2#0 0xbffabc32 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #1 0xbfbffa29 in raise () from /lib/tls/libc.so.6 #2 0xbfc01255 in abort () from /lib/tls/libc.so.6 #3 0xbfdc7537 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.5 #4 0xbfdc7584 in std::terminate() () from /usr/lib/libstdc++.so.5 #5 0xbfdc76f6 in __cxa_throw () from /usr/lib/libstdc++.so.5 #6 0xbfd80ebb in std::__throw_length_error(char const*) () from /usr/lib/libstdc++.so.5 #7 0xbfdb9c25 in std::string::_Rep::_S_create(unsigned, std::allocator const&) () from /usr/lib/libstdc++.so.5 #8 0xbfdb9d29 in std::string::_Rep::_M_clone(std::allocator const&, unsigned) () from /usr/lib/libstdc++.so.5 #9 0xbfdb678d in std::string::_Rep::_M_grab(std::allocator const&, std::allocator const&) () from /usr/lib/libstdc++.so.5 #10 0xbfdb8133 in std::string::assign(std::string const&) () from /usr/lib/libstdc++.so.5 I would like to ask what is the possible reason of these errors? I am using a dual Xeon CPU as my server. Is it related to this issue? Thanks a lot. Snow Dragon _______________________________________ ·Q§Y®É¦¬¨ì·s email ³qª¾¡H ¤U¸ü Yahoo! Messenger http://messenger.yahoo.com.hk