<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:10:44 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-821] Connections failing when active in process with other code that uses OpenSSL</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-821</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;When trying to use the C driver (embedded in Rust via &lt;a href=&quot;https://github.com/thijsc/mongo-rust-driver&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/thijsc/mongo-rust-driver&lt;/a&gt;) together with other code that uses OpenSSL connections fail.&lt;/p&gt;

&lt;p&gt;Everything works up until initialization of an OpenSSL context by another library. Then the trace below happens and connections fail.&lt;/p&gt;

&lt;p&gt;Is this a bug in the Mongo C driver? Should we maybe be using SSL_CTX_get_ex_new_index for example to scope the callbacks to just the C driver itself?&lt;/p&gt;

&lt;p&gt;```&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cursor - ENTRY: mongoc_cursor_more():875&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cursor -  EXIT: mongoc_cursor_more():885&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cursor - ENTRY: mongoc_cursor_next():741&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cursor - TRACE: mongoc_cursor_next():746 cursor_id(0)&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cursor - ENTRY: _mongoc_cursor_next():777&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cursor - ENTRY: _mongoc_cursor_query():476&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cluster - ENTRY: _mongoc_cluster_reconnect():2537&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cluster - ENTRY: _mongoc_cluster_update_state():115&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cluster -  EXIT: _mongoc_cluster_update_state():142&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cluster - ENTRY: _mongoc_cluster_reconnect_replica_set():2205&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;DEBUG&amp;#93;&lt;/span&gt; mongoc: cluster - Reconnecting to replica set.&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cluster - ENTRY: _mongoc_cluster_clear_peers():208&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: cluster -  EXIT: _mongoc_cluster_clear_peers():216&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: client - ENTRY: mongoc_client_connect_tcp():90&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: socket - ENTRY: mongoc_socket_new():609&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: socket - ENTRY: _mongoc_socket_setnodelay():182&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: socket -  EXIT: _mongoc_socket_setnodelay():194&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: socket -  EXIT: mongoc_socket_new():633&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: socket - ENTRY: mongoc_socket_connect():472&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: socket - ENTRY: _mongoc_socket_wait():123&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: socket -  EXIT: _mongoc_socket_wait():160&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;TRACE&amp;#93;&lt;/span&gt; mongoc: socket -  EXIT: mongoc_socket_connect():497&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2015-09-01T09:33:31&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;WARN&amp;#93;&lt;/span&gt; mongoc: cluster - Failed connection to mongo1.staging:27017&lt;br/&gt;
```&lt;/p&gt;</description>
                <environment>Tested on Ubuntu 14.04 64 bit.</environment>
        <key id="227900">CDRIVER-821</key>
            <summary>Connections failing when active in process with other code that uses OpenSSL</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="thijs">Thijs Cadier</reporter>
                        <labels>
                    </labels>
                <created>Tue, 1 Sep 2015 09:37:31 +0000</created>
                <updated>Wed, 3 May 2017 22:14:53 +0000</updated>
                            <resolved>Thu, 3 Sep 2015 16:39:22 +0000</resolved>
                                    <version>1.2-beta0</version>
                    <version>1.1.10</version>
                                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1131728" author="xgen-internal-githook" created="Mon, 11 Jan 2016 22:05:26 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-821&quot; title=&quot;Connections failing when active in process with other code that uses OpenSSL&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-821&quot;&gt;&lt;del&gt;CDRIVER-821&lt;/del&gt;&lt;/a&gt; warn that set_ssl_opts only copies the struct&lt;br/&gt;
Branch: 1.3.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/5d78a1944cdfa98912d71864701c3235ff47b04a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/5d78a1944cdfa98912d71864701c3235ff47b04a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1022610" author="xgen-internal-githook" created="Fri, 4 Sep 2015 15:22:11 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-821&quot; title=&quot;Connections failing when active in process with other code that uses OpenSSL&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-821&quot;&gt;&lt;del&gt;CDRIVER-821&lt;/del&gt;&lt;/a&gt; warn that set_ssl_opts only copies the struct&lt;br/&gt;
Branch: 1.2.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/5d78a1944cdfa98912d71864701c3235ff47b04a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/5d78a1944cdfa98912d71864701c3235ff47b04a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1021739" author="bjori" created="Thu, 3 Sep 2015 16:39:22 +0000"  >&lt;p&gt;We should definitely do something better about failure error message, see &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-543&quot; title=&quot;differentiate between network error and authentication error&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-543&quot;&gt;&lt;del&gt;CDRIVER-543&lt;/del&gt;&lt;/a&gt; for example.&lt;/p&gt;

&lt;p&gt;If you have concrete examples of how to reproduce a failure that could use a better messaging I&apos;d appreciate a new ticket or a comment on &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-543&quot; title=&quot;differentiate between network error and authentication error&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-543&quot;&gt;&lt;del&gt;CDRIVER-543&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Glad it wasn&apos;t OpenSSL context race condition &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="1021472" author="thijs" created="Thu, 3 Sep 2015 12:48:14 +0000"  >&lt;p&gt;I was actually thinking in the totally wrong direction. The issue was that the strings that I was putting in ssl options were being released from memory to early. I&apos;m now keeping them around for the whole lifetime of the pool. Thanks so much for your pointers, we can close this ticket.&lt;/p&gt;

&lt;p&gt;There is one area of improvement that could have prevented me being stuck for so long on this: The driver does not give any information about why a connection is failing. You can remove random lines from a pem file for example and it will just say connection failed. Maybe we should open an issue to expose this type of information in the error messages?&lt;/p&gt;</comment>
                            <comment id="1019429" author="thijs" created="Tue, 1 Sep 2015 15:20:21 +0000"  >&lt;p&gt;I will try this in the morning, have to leave now. I&apos;ll report back here. Thanks for the pointers!&lt;/p&gt;</comment>
                            <comment id="1019424" author="bjori" created="Tue, 1 Sep 2015 15:15:12 +0000"  >&lt;blockquote&gt;&lt;p&gt;If I just ping and don&apos;t use the cursor it does fail. What would that indicate?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;How do you do that? Are you sure the ping is sent to the server?&lt;/p&gt;

&lt;p&gt;A wild guess, it sounds like we may be using wrong method to create a ssl context. That seems very odd if we are..&lt;/p&gt;

&lt;p&gt;If you set a breakpoint on connect(), can you see what the return value and errno are?&lt;/p&gt;

&lt;p&gt;For example something like:&lt;br/&gt;
$ gdb myapp&lt;br/&gt;
(gdb) b connect&lt;br/&gt;
(gdb) run --optional-arguments-to-my-app&lt;br/&gt;
...&lt;br/&gt;
(gdb) next&lt;br/&gt;
(gdb) p ret&lt;br/&gt;
(gdb) p errno&lt;/p&gt;</comment>
                            <comment id="1019411" author="thijs" created="Tue, 1 Sep 2015 15:06:38 +0000"  >&lt;p&gt;Thanks for your reply Hannes, I am confused about OpenSSL indeed &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;.&lt;/p&gt;

&lt;p&gt;It does work the other way around, forgot to mention that. If I do a full query and fetch results from the cursor before the curl call it does not fail. If I just ping and don&apos;t use the cursor it does fail. What would that indicate?&lt;/p&gt;</comment>
                            <comment id="1019402" author="bjori" created="Tue, 1 Sep 2015 15:00:59 +0000"  >&lt;p&gt;How are you initializing the SSL context &quot;by another library&quot;?&lt;br/&gt;
And are these things happening in parallel?&lt;/p&gt;

&lt;p&gt;OpenSSL takes a special kind of person to grasp, but this sounds like confusion over correct which SSL context to use.&lt;/p&gt;

&lt;p&gt;Does it work the other way around, first you do mongoc query over SSL, and then initialize libcurl and the libcurl fetch works, or does that also break down?&lt;/p&gt;</comment>
                            <comment id="1019390" author="thijs" created="Tue, 1 Sep 2015 14:58:26 +0000"  >&lt;p&gt;I&apos;ll see if I can make it work. I have very very limited C skills.&lt;/p&gt;</comment>
                            <comment id="1019373" author="jesse" created="Tue, 1 Sep 2015 14:50:27 +0000"  >&lt;p&gt;Better if its in pure C, if that&apos;s possible. Thank you!&lt;/p&gt;

</comment>
                            <comment id="1019308" author="thijs" created="Tue, 1 Sep 2015 14:07:00 +0000"  >&lt;p&gt;I could provide a simple example in Rust, but that&apos;s probably not convenient for you?&lt;/p&gt;</comment>
                            <comment id="1019234" author="jesse" created="Tue, 1 Sep 2015 13:03:43 +0000"  >&lt;p&gt;Thanks for the report. Can you share with us some code to help reproduce the bug? Is the libcurl call the simplest reproduction?&lt;/p&gt;</comment>
                            <comment id="1019200" author="thijs" created="Tue, 1 Sep 2015 12:20:47 +0000"  >&lt;p&gt;Also just tested this with a libcurl call that handles SSL connections, same result.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="186188">CDRIVER-543</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hscuj3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>