<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:18:40 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-3654] Pooled handshake does not handle network errors correctly</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3654</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;If a network error occurs before the ismaster handshake completes, SDAM says this should invalidate the server description if the connection&apos;s generation is valid:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;If there is a network error or timeout on the connection before the handshake completes, the client MUST replace the server&apos;s description with a default ServerDescription of type Unknown, and fill the ServerDescription&apos;s error field with useful information.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The current behavior is a bit buggy.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;_mongoc_stream_run_ismaster&lt;/tt&gt;&#160;uses the current server description and runs a the ismaster with &lt;tt&gt;mongoc_cluster_run_command_private&lt;/tt&gt;. That function handles network errors as if they are post-handshake errors (invalidates a server if non-timeout). &lt;/p&gt;

&lt;p&gt;When that error bubbles up to &lt;tt&gt;_mongoc_cluster_stream_for_server&lt;/tt&gt;, it ends up invalidating the server again.&lt;/p&gt;

&lt;p&gt;I believe this has been a long-standing issue, and in practice this may not be terribly problematic to have multiple invalidations. Here&apos;s one such scenario where this could happen.&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Thread A creates a connection with generation 0.&lt;/li&gt;
	&lt;li&gt;Thread B receives a network error and invalidates the server, incrementing the generation to 1.&lt;/li&gt;
	&lt;li&gt;Thread A begins the handshake, calling &lt;tt&gt;_mongoc_stream_run_ismaster&lt;/tt&gt; which retrieves the server description with generation 1&lt;/li&gt;
	&lt;li&gt;Thread A receives a network error when performing the handshake, thinks it has the latest generation (though it really doesn&apos;t), and invalidates again.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The introduction of a connection generation of &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3615&quot; title=&quot;Reduce race conditions in SDAM error handling&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3615&quot;&gt;&lt;del&gt;CDRIVER-3615&lt;/del&gt;&lt;/a&gt; should prevent this behavior (only the first invalidation wins). Unfortunately, the server description retrieved by &lt;tt&gt;_mongoc_stream_run_ismaster&lt;/tt&gt; could have a later generation than when the stream was created (causing a double invalidation) and &lt;tt&gt;mongoc_cluster_run_command_private&lt;/tt&gt;  does not check the generation (so it always invalidates).&lt;/p&gt;</description>
                <environment></environment>
        <key id="1341331">CDRIVER-3654</key>
            <summary>Pooled handshake does not handle network errors correctly</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="kevin.albertson@mongodb.com">Kevin Albertson</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 May 2020 02:02:56 +0000</created>
                <updated>Thu, 23 Mar 2023 21:56:35 +0000</updated>
                                                                            <component>libmongoc</component>
                    <component>network</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                        <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|hr6jkc:2i</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>