Boost C++ Libraries: Ticket #11794: SSL context and/or stream valgrind reports conflicting access in libcrypto.so https://svn.boost.org/trac10/ticket/11794 <p> Creating SSL context and/or stream simultaneously from diferent threads, using io_service that has deferred handlers, or already running, makes valgrind drd tool reporting conflicting accesses in lybcrypto.so </p> <pre class="wiki">#include &lt;string&gt; #include &lt;iostream&gt; #include &lt;boost/asio.hpp&gt; #include &lt;boost/thread.hpp&gt; #include &lt;boost/asio/ssl.hpp&gt; #include "openssl/opensslconf.h" #include &lt;stdio.h&gt; #include &lt;pthread.h&gt; #include "openssl/err.h" typedef boost::asio::ip::tcp::socket TSocket; typedef boost::asio::ssl::stream&lt;TSocket&gt; TSSLSocket; typedef boost::asio::ssl::context TSSLContext; typedef boost::asio::io_service TService; typedef boost::asio::io_service::work TWork; int main() { const unsigned int threads_count=10; //Info std::cout&lt;&lt;"Open SSL library version="&lt;&lt;OPENSSL_VERSION_TEXT&lt;&lt;std::endl; #ifdef OPENSSL_THREADS std::cout&lt;&lt;"OpenSSL threads enabled"&lt;&lt;std::endl; #else std::cout&lt;&lt;"OpenSSL threads disabled"&lt;&lt;std::endl; #endif //Creating sockets simultaneously in diferent threads auto create_ssl_socket=[&amp;] { TService service; //boost::asio::ioservice::work makes bug appear TWork work(service); TSSLContext context(boost::asio::ssl::context::tlsv1_client); TSSLSocket ssl_socket(service,context); service.run(); }; for (unsigned i=0; i&lt;=threads_count;i++) { boost::thread t(create_ssl_socket); t.detach(); } do { std::cout&lt;&lt;"Press enter to quit..."&lt;&lt;std::endl; } while (std::cin.get()==0); return 0; } </pre><pre class="wiki">valgrind --tool=drd --gen-suppressions=all --first-race-only=yes --read-var-info=yes --num-callers=100 --xml=yes --xml-file=drd.xml ./executale_name </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11794 Trac 1.4.3 Aleksey Barsuk <barsuk.alexey@…> Fri, 13 Nov 2015 10:04:13 GMT attachment set https://svn.boost.org/trac10/ticket/11794 https://svn.boost.org/trac10/ticket/11794 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_ssl_test.tgz</span> </li> </ul> <p> test suite </p> Ticket Aleksey Barsuk <barsuk.alexey@…> Fri, 13 Nov 2015 10:07:32 GMT attachment set https://svn.boost.org/trac10/ticket/11794 https://svn.boost.org/trac10/ticket/11794 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">drd.xml</span> </li> </ul> <p> valgrind output </p> Ticket Aleksey Barsuk <barsuk.alexey@…> Fri, 13 Nov 2015 10:08:40 GMT summary changed https://svn.boost.org/trac10/ticket/11794#comment:1 https://svn.boost.org/trac10/ticket/11794#comment:1 <ul> <li><strong>summary</strong> <span class="trac-field-old">SSL context and/or stream valgrind confliction access</span> → <span class="trac-field-new">SSL context and/or stream valgrind reports conflicting access in libcrypto.so</span> </li> </ul> Ticket Aleksey Barsuk <barsuk.alexey@…> Fri, 13 Nov 2015 10:08:51 GMT version changed https://svn.boost.org/trac10/ticket/11794#comment:2 https://svn.boost.org/trac10/ticket/11794#comment:2 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.57.0</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> Ticket viboes Sat, 21 Nov 2015 20:38:23 GMT component changed; owner set https://svn.boost.org/trac10/ticket/11794#comment:3 https://svn.boost.org/trac10/ticket/11794#comment:3 <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