Boost C++ Libraries: Ticket #9439: boost::spawn core dump https://svn.boost.org/trac10/ticket/9439 <p> My program generate an core dump when I create 50000 coroutines.The number of coroutines is too big? </p> <p> gcc version 3.4.5 20051201 (Red Hat 3.4.5-2) </p> <p> My program is: #include &lt;boost/bind.hpp&gt; #include &lt;boost/asio/io_service.hpp&gt; #include &lt;boost/asio/ip/tcp.hpp&gt; #include &lt;boost/asio/spawn.hpp&gt; #include &lt;boost/asio/steady_timer.hpp&gt; #include &lt;boost/asio/write.hpp&gt; #include &lt;iostream&gt; #include &lt;memory&gt; #include &lt;sys/time.h&gt; #include &lt;sys/resource.h&gt; #include &lt;unistd.h&gt; using boost::asio::ip::tcp; </p> <p> void do_echo(boost::asio::yield_context yield, </p> <blockquote> <p> boost::asio::io_service *io_service) { </p> </blockquote> <blockquote> <p> for (; ;) { </p> <blockquote> <p> try { </p> <blockquote> <p> tcp::socket sock(*io_service); tcp::endpoint ep(boost::asio::ip::address::from_string("127.0.0.1"), 19011); sock.async_connect(ep, yield); std::cout&lt;&lt; 1 &lt;&lt;std::endl ; </p> </blockquote> <p> } catch (...) { </p> <blockquote> <p> std::cout&lt;&lt;"test"; </p> </blockquote> <p> } </p> </blockquote> <p> } </p> </blockquote> <p> } </p> <p> int main(int argc, char* argv[]) { </p> <blockquote> <p> try { </p> <blockquote> <p> boost::asio::io_service io_service; for (int i=0; i&lt;50000; ++i) { </p> <blockquote> <p> boost::asio::spawn(io_service, boost::bind(&amp;do_echo, _1, &amp;io_service)); </p> </blockquote> <p> } io_service.run(); </p> </blockquote> </blockquote> <blockquote> <p> } catch(...) { </p> <blockquote> <p> std::cerr &lt;&lt; "Exception:\n"; </p> </blockquote> <p> } return 0; </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9439 Trac 1.4.3 viboes Fri, 29 Nov 2013 21:25:26 GMT component changed; owner set https://svn.boost.org/trac10/ticket/9439#comment:1 https://svn.boost.org/trac10/ticket/9439#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">chris_kohlhoff</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">asio</span> </li> </ul> Ticket Dmitry Kadashev <dkadashev@…> Mon, 21 Jul 2014 07:30:19 GMT <link>https://svn.boost.org/trac10/ticket/9439#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9439#comment:2</guid> <description> <p> The same test program crashes for me too with gcc 4.9 and boost 1.55. Actually it reliably crashes even with 2000 coroutines, and sometimes crashes with 1000. </p> <pre class="wiki">% gcc --version gcc (Debian 4.9.0-7) 4.9.0 </pre><p> I think it has something to do with <code>async_connect()</code>, because in a larger program I was working on handling incoming connections seems to work fine, but when it comes to connecting to another server it crashes shortly. Disabling these connects and just serving client some static error response seems to prevent crashes. </p> </description> <category>Ticket</category> </item> <item> <author>Dmitry Kadashev <dkadashev@…></author> <pubDate>Thu, 24 Jul 2014 07:12:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9439#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9439#comment:3</guid> <description> <p> This doesn't seem to happen with boost 1.56 beta. </p> </description> <category>Ticket</category> </item> <item> <author>348944179@…</author> <pubDate>Tue, 28 Oct 2014 12:16:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9439#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9439#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9439#comment:3" title="Comment 3">Dmitry Kadashev &lt;dkadashev@…&gt;</a>: </p> <blockquote class="citation"> <p> This doesn't seem to happen with boost 1.56 beta. </p> </blockquote> <p> Yes, since 1.56 500000 coroutines I tested; But before it, 40000 crash on my machine, even no socket(just using boost::asio::system_timer on each coroutine to sleep). </p> </description> <category>Ticket</category> </item> <item> <author>348944179@…</author> <pubDate>Tue, 28 Oct 2014 12:26:46 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/9439 https://svn.boost.org/trac10/ticket/9439 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_spawn.cpp</span> </li> </ul> <p> success tested 500000 coroutines using boost 1.56.0 </p> Ticket