Boost C++ Libraries: Ticket #3958: ssl::stream async_read_some and async_write_some handlers never run concurrently
https://svn.boost.org/trac10/ticket/3958
<p>
Handlers passed to ssl::stream::async_read_some and ssl::stream::async_write_some are always invoked in the context of a strand. This strand is a member of openssl_stream_service, which is typically a process-wide instance.
</p>
<p>
The effect of this is that a time-consuming async_read_some handler on one ssl::stream instance can block all other async_read_some and async_write_some handlers on other instances of ssl::stream.
</p>
<p>
The code that does this is in boost/asio/ssl/detail/openssl_operation.hpp. Line 319 performs strand::wrap on the callback to openssl_operation::async_write_handler. At lines 367 and 373, async_write_handler invokes the user's handler function (passed to ssl::stream::async_write_some). This runs in the context of strand_.
</p>
<p>
The strand instance in this case is always openssl_stream_service::strand_, as can be seen in asio/ssl/detail/openssl_stream_service.hpp, line 395.
</p>
<p>
The situation for async_read_handler is similar.
</p>
en-usBoost C++ Libraries/htdocs/site/boost.png
https://svn.boost.org/trac10/ticket/3958
Trac 1.4.3samjmill@…Fri, 04 Jun 2010 12:29:42 GMTcc set
https://svn.boost.org/trac10/ticket/3958#comment:1
https://svn.boost.org/trac10/ticket/3958#comment:1
<ul>
<li><strong>cc</strong>
<span class="trac-author">samjmill@…</span> added
</li>
</ul>
TicketanonymousWed, 23 Jun 2010 14:13:32 GMT
<link>https://svn.boost.org/trac10/ticket/3958#comment:2 </link>
<guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3958#comment:2</guid>
<description>
<p>
This bug leads to such a great performance degradation. SSL version of my sample appliction is about 50 times slower than the same application with raw TCP/IP sockets.
</p>
</description>
<category>Ticket</category>
</item>
<item>
<author>tianhao.qiu@…</author>
<pubDate>Thu, 12 Aug 2010 22:44:47 GMT</pubDate>
<title/>
<link>https://svn.boost.org/trac10/ticket/3958#comment:3 </link>
<guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3958#comment:3</guid>
<description>
<p>
Patch submitted based on the post: <a class="ext-link" href="http://permalink.gmane.org/gmane.comp.lib.boost.asio.user/4099"><span class="icon"></span>http://permalink.gmane.org/gmane.comp.lib.boost.asio.user/4099</a>
</p>
</description>
<category>Ticket</category>
</item>
<item>
<author>tianhao.qiu@…</author>
<pubDate>Thu, 12 Aug 2010 22:45:34 GMT</pubDate>
<title>attachment set
https://svn.boost.org/trac10/ticket/3958
https://svn.boost.org/trac10/ticket/3958
<ul>
<li><strong>attachment</strong>
→ <span class="trac-field-new">asio_ssl_strand.patch</span>
</li>
</ul>
<p>
<a class="ext-link" href="http://permalink.gmane.org/gmane.comp.lib.boost.asio.user/4099"><span class="icon"></span>http://permalink.gmane.org/gmane.comp.lib.boost.asio.user/4099</a>
</p>
TicketdremonTue, 07 Dec 2010 21:18:15 GMT
<link>https://svn.boost.org/trac10/ticket/3958#comment:4 </link>
<guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3958#comment:4</guid>
<description>
<p>
This patch also solves a deadlock problem when making recursive connection to the server.
There was a deadlocked async_handshake called from the read_handler, now it works ok with this patch.
</p>
</description>
<category>Ticket</category>
</item>
<item>
<dc:creator>anonymous</dc:creator>
<pubDate>Wed, 08 Dec 2010 09:36:34 GMT</pubDate>
<title/>
<link>https://svn.boost.org/trac10/ticket/3958#comment:5 </link>
<guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3958#comment:5</guid>
<description>
<p>
Correction: it still deadlocks occasionally, but at least the server still accepts other connections.
Without the patch the server was completely locked.
</p>
</description>
<category>Ticket</category>
</item>
<item>
<dc:creator>fred</dc:creator>
<pubDate>Tue, 01 Feb 2011 09:01:56 GMT</pubDate>
<title/>
<link>https://svn.boost.org/trac10/ticket/3958#comment:6 </link>
<guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3958#comment:6</guid>
<description>
<p>
I thought that with open-sources, fixes come quickly... tianhao provided a fix (thanks for him)... Why is it so long to integrate it in the next release?
</p>
</description>
<category>Ticket</category>
</item>
<item>
<dc:creator>chris_kohlhoff</dc:creator>
<pubDate>Mon, 06 Jun 2011 01:48:20 GMT</pubDate>
<title>status changed; resolution set
https://svn.boost.org/trac10/ticket/3958#comment:7
https://svn.boost.org/trac10/ticket/3958#comment:7
<ul>
<li><strong>status</strong>
<span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span>
</li>
<li><strong>resolution</strong>
→ <span class="trac-field-new">fixed</span>
</li>
</ul>
<p>
As of <a class="changeset" href="https://svn.boost.org/trac10/changeset/72428" title="Merge asio from trunk.">[72428]</a>, release branch contains the new SSL implementation.
</p>
Ticket