|
Boost Users : |
From: mailinglist_at_[hidden]
Date: 2006-07-10 18:16:34
Hello,
I'm having a few problems with boost::regex_replace seg faulting when used
in a multithreaded program. The problem seems to be identical to the one
described in http://lists.boost.org/boost-users/2006/06/20235.php, with a
seg fault on line 133 of regex_format.hpp, though I have linked against the
multithreaded version of libboost_regex.so and the problem is still
happening. Unfortunately, I never saw any definitive answer for what was
causing the original poster's problems.
===========================================
Stack trace:
===========================================
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -584664144 (LWP 28385)] 0x080520e0 in
boost::re_detail::basic_regex_formatter<boost::re_detail::string_out_ite
rator<std::string>, boost::match_results<char const*,
std::allocator<boost::sub_match<char const*> > >,
boost::regex_traits_wrapper<boost::regex_traits<char,
boost::cpp_regex_traits<char> > > >::format_all (this=0xdd26b8d0) at
regex_format.hpp:133
133 switch(*m_position)
(gdb) where
#0 0x080520e0 in
boost::re_detail::basic_regex_formatter<boost::re_detail::string_out_ite
rator<std::string>, boost::match_results<char const*,
std::allocator<boost::sub_match<char const*> > >,
boost::regex_traits_wrapper<boost::regex_traits<char,
boost::cpp_regex_traits<char> > > >::format_all (this=0xdd26b8d0) at
regex_format.hpp:133
#1 0x080518be in
boost::re_detail::basic_regex_formatter<boost::re_detail::string_out_ite
rator<std::string>, boost::match_results<char const*,
std::allocator<boost::sub_match<char const*> > >,
boost::regex_traits_wrapper<boost::regex_traits<char,
boost::cpp_regex_traits<char> > > >::format (this=0xdd26b8d0, p1=0xd55005dc
"$1", p2=0xd55005de "",
f=format_all) at regex_format.hpp:123
#2 0x08051073 in
boost::re_detail::regex_format_imp<boost::re_detail::string_out_iterator
<std::string>, char const*, std::allocator<boost::sub_match<char const*>
>, char, boost::regex_traits_wrapper<boost::regex_traits<char,
boost::cpp_regex_traits<char> > > > (out=
{<std::iterator<std::output_iterator_tag, char, int, char*, char&>> =
{<No data fields>}, out = 0xdd26ba70}, m=@0xd5500518, p1=0xd55005dc "$1",
p2=0xd55005de "",
flags=format_all, t=@0x8064140) at regex_format.hpp:569
#3 0x08050710 in
format<boost::re_detail::string_out_iterator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > > >
(this=0xd5500518, out={<std::iterator<std::output_iterator_tag, char, int,
char*, char&>> = {<No data fields>}, out = 0xdd26ba70},
fmt=@0xdd26b990, flags=format_all, re=@0x805f6ec) at
match_results.hpp:170
#4 0x0804fe35 in
boost::regex_replace<boost::re_detail::string_out_iterator<std::string>,
char const*, boost::regex_traits<char, boost::cpp_regex_traits<char> >,
char> (out=
{<std::iterator<std::output_iterator_tag, char, int, char*, char&>> =
{<No data fields>}, out = 0xdd26ba70}, first=0xd550048c "abcdefgh",
last=0xd5500494 "", e=@0x805f6ec,
fmt=0x805a2a9 "$1", flags=format_all) at regex_replace.hpp:53
#5 0x0804f7e1 in boost::regex_replace<boost::regex_traits<char,
boost::cpp_regex_traits<char> >, char> (s=@0xdd26ba80, e=@0x805f6ec,
fmt=0x805a2a9 "$1", flags=format_all)
at regex_replace.hpp:84
#6 0x0804f3c4 in test_fn () at regexTest.C:32
#7 0xf63e5dec in start_thread () from /lib/tls/libpthread.so.0
#8 0xf6385a2a in clone () from /lib/tls/libc.so.6
(gdb) print *this
$1 = {m_traits = @0x8064140, m_results = @0xd5500518, m_out =
{<std::iterator<std::output_iterator_tag, char, int, char*, char&>> = {<No
data fields>}, out = 0xdd26ba70},
m_position = 0xd44ff5d6 <Address 0xd44ff5d6 out of bounds>, m_end =
0xd55005de "", m_flags = format_all, m_state = output_copy,
m_have_conditional = false}
==========================================
GCC version is 3.2.3 20030502 (Red Hat Linux 3.2.3-42), with Boost 1.33.1,
on a 4 CPU machine.
We're using the STL from RogueWave, though since the post from a couple of
weeks ago had the same problem with both GCC and STLport libraries I don't
think that's the problem. This problem also occurs with version 1.33.0, but
not with 1.32 or earlier.
Does anyone know if there is a known problem with using these new versions
of boost::regex_replace in multiple threads? If it's helpful, I have a very
simple test program that demonstrates the problem. Any help on this would be
greatly appreciated.
Kind regards,
Alistair Potts
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net