Re: [Boost-bugs] [Boost C++ Libraries] #7666: Boost Thread SIGSEGV on join() when -D_GLIBCXX_DEBUG is used

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7666: Boost Thread SIGSEGV on join() when -D_GLIBCXX_DEBUG is used
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-23 22:02:10


#7666: Boost Thread SIGSEGV on join() when -D_GLIBCXX_DEBUG is used
-------------------------------------+-------------------------------------
  Reporter: Antonio Di Monaco | Owner: viboes
  <tony@…> | Status: assigned
      Type: Bugs | Component: thread
 Milestone: To Be Determined | Severity: Problem
   Version: Boost 1.52.0 | Keywords: thread SIGSEGV C++11
Resolution: | -D_GLIBCXX_DEBUG
-------------------------------------+-------------------------------------

Comment (by Chris Kogelnik):

 I'm also seeing a Seg Fault on OS X 10.8 and boost 1.54 (and earlier) when
 issuing a thread.join(). A large project was previously working
 correctly until XCode was upgraded from 4 to 5. Reduced the case and
 traced it back to a compiler setting:
    -stdlib=libc++ causes the crash

    -stdlib=libstdc++ works fine

 The DEBUG flag had nothing to do with it in this case.

 Hope this helps your debugging.


 There is the example, thread.cpp:

 {{{
 #include <stdio.h>
 #include <stdlib.h>
 #include <boost/thread.hpp>
 #include <time.h>
 #include <unistd.h>

 using namespace std;

 void
 t1() {
   while (loop) {
     sleep(1);
   }
   printf("exiting\n");
   fflush(stdout);
 }

 int
 main() {
   int loop = 1;
   boost::thread t1_thread;

   t1_thread = boost::thread(t1);
   loop = 0;
   t1_thread.join();
 }
 }}}

 The Makefile:
 {{{
 OPT_FAIL = -stdlib=libc++
 OPT_PASS = -stdlib=libstdc++

 thread: thread.cpp Makefile
   g++ -o thread thread.cpp -lboost_system -lboost_thread $(OPT_FAIL)
 }}}


 And the stack trace:
 {{{
 #0 boost::shared_ptr<boost::detail::future_object_base>::operator-> () at
 /boost_1_54_0/boost/smart_ptr/shared_ptr.hpp:652
 #1 0x00000001038788c0 in
 boost::detail::thread_data_base::~thread_data_base (this=0x7fddbb403aa0)
 at libs/thread/src/pthread/thread.cpp:47
 #2 0x000000010384a235 in boost::detail::thread_data<void
 (*)()>::~thread_data ()
 #3 0x00000001038493e5 in boost::detail::thread_data<void
 (*)()>::~thread_data ()
 #4 0x0000000103849408 in boost::detail::thread_data<void
 (*)()>::~thread_data ()
 #5 0x000000010384b62e in
 boost::checked_delete<boost::detail::thread_data<void (*)()> > ()
 #6 0x000000010384b749 in
 boost::detail::sp_counted_impl_p<boost::detail::thread_data<void (*)()>
>::dispose ()
 #7 0x000000010387955d in boost::detail::atomic_exchange_and_add () at
 /boost_1_54_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146
 #8 0x000000010387955d in boost::detail::sp_counted_base::weak_release ()
 at /boost_1_54_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:158
 #9 0x000000010387955d in boost::detail::sp_counted_base::release () at
 sp_counted_base_gcc_x86.hpp:147
 #10 0x000000010387955d in boost::detail::shared_count::~shared_count () at
 sp_counted_base_gcc_x86.hpp:371
 #11 0x000000010387955d in
 boost::shared_ptr<boost::detail::thread_data_base>::~shared_ptr () at
 sp_counted_base_gcc_x86.hpp:370
 #12 0x000000010387955d in
 boost::shared_ptr<boost::detail::thread_data_base>::~shared_ptr () at
 /boost_1_54_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:722
 #13 0x000000010387955d in boost::thread::join_noexcept (this=<value
 temporarily unavailable, due to optimizations>) at
 sp_counted_base_gcc_x86.hpp:338
 #14 0x0000000103847344 in boost::thread::join ()
 #15 0x0000000103846688 in main ()
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7666#comment:33>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC