This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/10350: thread-safety problem in std::string.


 
We are having some crashes with stdc++.  It happens on
a 2-processor i686 machine - the crashes went away if
we boot the same machine with only one processor.
 
Also, core dumps only happen under heavy loads - no
crashes if the threads are not many.
 
The core dumps scatters over a handful of places - in
std::string, std::basic_string<wchar_t>, std::map,
std::_Rb_tree, std::__default_alloc_template,
std::pair, std::_List_base, std::_Rb_tree_rebalance,
std::_Rb_tree_rotate_left, etc.
 
The os is Redhat Linux 7.3, The version we have are  
compat-libstdc++-6.2-2.9.0.16
libstdc++3-3.0.4-1
libstdc++-2.96-113

libc-2.2.5-43
glibc-common-2.2.5-43

The cpus are 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 11
model name      : Intel(R) Pentium(R) III CPU family  
   1266MHz
stepping        : 1
cpu MHz         : 1266.098
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8
apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips        : 2529.68
processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 11
model name      : Intel(R) Pentium(R) III CPU family  
   1266MHz
stepping        : 1
cpu MHz         : 1266.098
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8
apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips        : 2529.68
 
Typical trace back of the cores are like these:
 
---------------------------------------------------------------------------------------------------------
#0  0x082426e8 in std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>
>::_Rep::_S_create(unsigned, std::allocator<wchar_t>
const&) ()
#1  0x082424dc in wchar_t* std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>
>::_S_construct<wchar_t const*>(wchar_t const*,
wchar_t const*, std::allocator<wchar_t> const&,
std::forward_iterator_tag) (__beg=0x84b4bdc,
__end=0x84b4bf0, 
    __a=@0x41b5b50c) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/basic_string.tcc:143
#2  0x082423bc in std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>
>::basic_string(wchar_t const*,
std::allocator<wchar_t> const&) (this=0x41b5b60c,
__s=0x84b4bdc, __a=@0x41b5b50c)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/basic_string.h:666
#3  0x081fbb9f in toString(wchar_t const*)
(s=0x84b4bdc) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_alloc.h:571
#4  0x081fcb9e in
PropertyList::SetProperties(VXMLElement const&,
PropertyLevel, VXIMapHolder const&) (this=0x85c6fa4, 
    doc=@0x85c6f48, level=DIALOG_PROP,
docProps=@0x41b5b6cc) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_pair.h:84

---------------------------------------------------------------------------------------------------------
or
 
---------------------------------------------------------------------------------------------------------
#0  0x08243539 in std::__default_alloc_template<true,
0>::allocate(unsigned) (__n=24)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_alloc.h:338
#1  0x082486c7 in
std::_Rb_tree_base<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>, std::allocator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
>
>::_Rb_tree_base(std::allocator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
> const&) (this=0x49dfe12c, 
    __a=@0x49dfe10c) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_alloc.h:184
#2  0x081fec9d in
PropertyList::GetProperties(VXIMapHolder&) const
(this=0x47a62f3c, m=@0x49dfe33c)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_tree.h:647

---------------------------------------------------------------------------------------------------------
or
 
---------------------------------------------------------------------------------------------------------
#0  0x42029241 in kill () from /lib/i686/libc.so.6
#1  0x400ccc4b in raise () from
/lib/i686/libpthread.so.0
#2  0x4202a7d2 in abort () from /lib/i686/libc.so.6
#3  0x40095405 in __cxxabiv1::__terminate(void (*)())
(handler=0x8055aa4 <abort>)
    at
../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x40095440 in __cxxabiv1::__unexpected(void (*)())
(handler=0x8386db0) at
../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x400955b0 in __cxa_rethrow () at
../../../../libstdc++-v3/libsupc++/eh_throw.cc:77
#6  0x4005ce0a in std::__throw_length_error(char
const*) (__s=0x8273d51 "basic_string::_S_create")
    at ../../../../libstdc++-v3/src/functexcept.cc:70
#7  0x0824265f in std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>
>::_Rep::_S_create(unsigned, std::allocator<wchar_t>
const&) (__capacity=1176815353, __alloc=@0x4a9fddbc)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/basic_string.tcc:368
#8  0x08242568 in std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>
>::_M_mutate(unsigned, unsigned, unsigned)
(this=0x4a9fde80, __pos=103073528, __len1=0, __len2=1)
at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_alloc.h:572
#9  0x08242f8e in std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>
>::replace(std::__normal_iterator<wchar_t*,
std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> > >,
std::__normal_iterator<wchar_t*,
std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> > >, unsigned, wchar_t)
(this=0x4a9fde80, __i1=
     
{<iterator<std::random_access_iterator_tag,wchar_t,int,wchar_t*,wchar_t&>>
= {<No data fields>}, _M_current = 0x5eb7e294}, 
    __i2=
     
{<iterator<std::random_access_iterator_tag,wchar_t,int,wchar_t*,wchar_t&>>
= {<No data fields>}, _M_current = 0x5eb7e294}, 
    __n2=1, __c=57) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/basic_string.tcc:566
#10 0x08242ea6 in std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>
>::append(unsigned, wchar_t) (
    this=0x4a9fde80, __n=1, __c=57) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/basic_string.h:254
#11 0x081dd391 in SBinetValidator::Serialize() const
(this=0x4a9fdf0c)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/basic_string.h:460

---------------------------------------------------------------------------------------------------------
or
---------------------------------------------------------------------------------------------------------
#0  std::_Rb_tree<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>,
std::_Select1st<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
>, std::less<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>, std::allocator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
>
>::insert_unique(std::_Rb_tree_iterator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>&, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>*>, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
const&) (this=0x4b5fe12c, __position=0x4b5fe0ac, 
    __v=@0x4b5fe0cc) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/basic_string.h:246
#1  0x081fed79 in
PropertyList::GetProperties(VXIMapHolder&) const
(this=0x44281064, m=@0x4b5fe33c)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_tree.h:191
#2  0x08227e73 in
GrammarManager::GetRecProperties(PropertyList const&,
int) const (this=0x44281034, props=@0x44281064,
timeout=-1)
    at GrammarManager.cpp:1014

---------------------------------------------------------------------------------------------------------
or
---------------------------------------------------------------------------------------------------------
0  std::_Rb_tree_rotate_left(std::_Rb_tree_node_base*,
std::_Rb_tree_node_base*&) (__x=0x47af89f8,
__root=@0x48a1ef0c)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_tree.h:253
#1  0x08248458 in
std::_Rb_tree_rebalance(std::_Rb_tree_node_base*,
std::_Rb_tree_node_base*&) (__x=0x48a6e0c8,
__root=@0x48a1ef0c)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_tree.h:323
#2  0x0824811a in
std::_Rb_tree<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>,
std::_Select1st<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
>, std::less<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>, std::allocator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
> >::_M_insert(std::_Rb_tree_node_base*,
std::_Rb_tree_node_base*,
std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
const&) (this=0x4dcfdd6c, 
    __x_=0x0, __y_=0x47af83c0, __v=@0x4dcfdd0c) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_tree.h:866
#3  0x08247a85 in
std::_Rb_tree<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>,
std::_Select1st<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
>, std::less<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>, std::allocator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
>
>::insert_unique(std::_Rb_tree_iterator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>&, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>*>, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
const&) (this=0x4dcfdd6c, 
    __position=0x4dcfdcec, __v=@0x4dcfdd0c) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_tree.h:941
#4  0x081fed79 in
PropertyList::GetProperties(VXIMapHolder&) const
(this=0x47d795dc, m=@0x4dcfdf7c)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_tree.h:191

---------------------------------------------------------------------------------------------------------
or
---------------------------------------------------------------------------------------------------------
#0  std::_Rb_tree<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>,
std::_Select1st<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
>, std::less<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>, std::allocator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
>
>::insert_unique(std::_Rb_tree_iterator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>&, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
>*>, std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >
const, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >
const&) (this=0x492fe12c, __position=0x492fe0ac, 
    __v=@0x492fe0cc) at
/usr/local/gcc-3.0.2/include/g++-v3/bits/basic_string.h:238
#1  0x081fed79 in
PropertyList::GetProperties(VXIMapHolder&) const
(this=0x48563eac, m=@0x492fe33c)
    at
/usr/local/gcc-3.0.2/include/g++-v3/bits/stl_tree.h:191
#2  0x08227e73 in
GrammarManager::GetRecProperties(PropertyList const&,
int) const (this=0x48563e7c, props=@0x48563eac,
timeout=-1)
    at GrammarManager.cpp:1014

---------------------------------------------------------------------------------------------------------
 
And I have more.  
 
The software was build with gcc 3.0.2.  
 
Any ideas?
 
Thanks!
 
Fred



__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]