Re: [Boost-bugs] [Boost C++ Libraries] #9355: boost::coroutine crash in base<void>::pull_coroutine_base<void> with multiple threads

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9355: boost::coroutine crash in base<void>::pull_coroutine_base<void> with multiple threads
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-11-08 08:20:19


#9355: boost::coroutine crash in base<void>::pull_coroutine_base<void> with
multiple threads
-------------------------------+----------------------------------------
  Reporter: craig@… | Owner: olli
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: coroutine
   Version: Boost 1.55.0 | Severity: Problem
Resolution: invalid | Keywords: pull_coroutine_base; crash
-------------------------------+----------------------------------------

Comment (by Craig Hutchinson <craig@…>):

 I have simplified down the test further removing all the logic and the use
 of vectors etc. You are right in that most of it is unrelated to the
 crashing and the issue still occurs.

 Afterward is a new batch script too I have seen runs of ~100 without fail
 but have also seen the lucky crash inside the debugger but its the same as
 attaching after failure.

 Test Code:
 {{{
 #include <boost/coroutine/all.hpp>
 #include <boost/lockfree/queue.hpp>
 #include <boost/bind.hpp>
 #include <thread>
 #include <queue>

 typedef boost::coroutines::coroutine< void > coro_t;

 static void foo( coro_t::push_type& yield, int i )
 {}

 struct Worker
 {
         Worker() : done(false) {}
         volatile bool done;

         void operator()()
         {
                 while ( !done )
                 {
                         pending.consume_all( [&]( int i )
                         {
                                 coro_t::pull_type( boost::bind( foo, _1, i
 ) );
                         } );
                 }
         }

         boost::lockfree::queue<int, boost::lockfree::capacity<1024> >
 pending;
 };

 int main( int argc, char * argv[])
 {
         Worker workers[2];
         std::thread threads[2] = { std::thread(std::ref(workers[0])) ,
 std::thread(std::ref(workers[1])) };
         workers[0].pending.push(0);
         workers[1].pending.push(1);

         for ( auto& worker: workers )
                 worker.done = true;

         for ( auto& thread: threads )
                 thread.join();

         return EXIT_SUCCESS;
 }
 }}}

 Batch script:
 {{{
 echo off
 cls
 set counter=0
 :loop
 set /a counter=counter+1
 echo run %counter%
 x64\Release\ConcurrencyTest.exe

 goto loop
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9355#comment:5>
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