<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:25:21 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>[DRIVERS-2347] Prevent conflating operation timeout with connection establishment timeout</title>
                <link>https://jira.mongodb.org/browse/DRIVERS-2347</link>
                <project id="10980" key="DRIVERS">Drivers</project>
                    <description>&lt;div class=&quot;panel&quot; style=&quot;background-color: #fafbfc;border-color: #21313c;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelContent&quot; style=&quot;background-color: #fafbfc;&quot;&gt;
&lt;h3&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/h3&gt;
&lt;p&gt;The process for &lt;a href=&quot;https://github.com/mongodb/specifications/blob/bf372a162c304b3f57dccbda00346241ad0cbf17/source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst#id32&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;checking out and establishing connections&lt;/a&gt; described in the CMAP spec combined with the timeout behavior described in the &lt;a href=&quot;https://github.com/mongodb/specifications/blob/bf372a162c304b3f57dccbda00346241ad0cbf17/source/client-side-operations-timeout/client-side-operations-timeout.rst#server-selection&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Server Selection&lt;/a&gt; cause issues when users specify low operation timeouts.&lt;/p&gt;

&lt;p&gt;Specifically, the CMAP spec describes that if there are no available connections, a connection pool should establish a new connection in-line with the check-out. The CSOT spec describes that the timeout used to create a TCP/TLS connection is &lt;tt&gt;min(connectTimeoutMS, min(serverSelectionTimeoutMS, remaining timeoutMS))&lt;/tt&gt; and the timeout used to handshake with the MongoDB server should be &lt;tt&gt;min(operationTimeout, remaining computedServerSelectionTimeout)&lt;/tt&gt;. As a result, if an operation times out, any in-progress connection establishment necessarily times out as well. If most operations have low timeouts (e.g. 1-5 seconds), the driver may not have enough time to establish any new connections, leading to a state where the driver cannot create any connections.&lt;/p&gt;

&lt;p&gt;Consider the case discovered in the Go driver, which supports client-side operation timeouts via the Go &lt;tt&gt;context.Context&lt;/tt&gt; type:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The current Go driver connection pool creates most new connections in-line with operations when there are no available idle connections. As a result, the Go driver times out new connection creation on either &lt;tt&gt;connectTimeoutMS&lt;/tt&gt; or the operation &lt;tt&gt;context.Context&lt;/tt&gt; timeout, whichever is shorter. The conflation of operation timeout with new connection creation timeout makes using operation timeouts in the Go driver complicated. The problem is exacerbated when the majority of operations use low operation timeouts (e.g. 1-5 second timeouts), when the operation frequency is high and bursty (e.g 1,000+ op/sec), and when the time to establish a new connection is high (e.g. when TLS and auth handshake are enabled).&lt;/p&gt;

&lt;p&gt;The result is that the current Go driver can enter a state where all connections in a connection pool are perished (usually caused by a connection pool clear due to encountering a timeout during new connection establishment) and almost no new connections can be established in-line with an operation due to the low operation timeout. Customers using the Go driver may encounter application outages as a result of the Go driver&#8217;s inability to recover from this state.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Note that the above was relevant for Go Driver v1.7.x and earlier. See &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2038&quot; title=&quot;Use &amp;quot;ConnectionTimeout&amp;quot; for creating all new connections and background connection creation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2038&quot;&gt;&lt;del&gt;GODRIVER-2038&lt;/del&gt;&lt;/a&gt; for more context.&lt;/p&gt;

&lt;p&gt;Any driver that implements a connection pool as described in the current CMAP spec and implments client-side operation timeout as described in the current CSOT spec will potentially encounter the same issue discovered in the Go driver. To prevent that issue, drivers must never let operation timeout influence connection establishment timeout. Honoring both operation timeout and connection establishment timeout requires running connection check-out and connection establishment in different threads. Drivers should continue connection establishment for &lt;tt&gt;connectTimeoutMS&lt;/tt&gt;, even if the check-out that requested the new connection times out.&lt;/p&gt;

&lt;p&gt;Update the CMAP spec to describe the necessary separation of threads of execution between connection check-out and connection establishment. Update the CSOT spec to describe that connection establishment should always use a timeout of &lt;tt&gt;connectionTimeoutMS&lt;/tt&gt;, independent of operation timeout. Note that implementing CSOT likely requires drivers to refactor their connection pool implementations.&lt;/p&gt;

&lt;p&gt;Note that an alternative to separate threads is to always continue establishing connections for &lt;tt&gt;connectTimeoutMS&lt;/tt&gt;, even if the operation timeout has expired.&lt;/p&gt;

&lt;p&gt;Consider the list of drivers that &lt;a href=&quot;https://docs.google.com/spreadsheets/d/18tICTVSAuEn_MI29xW30c1ps9Mxr9iwxX6S-e7Erro8/edit#gid=0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;establish connections in the checkOut function&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a name=&quot;Motivation&quot;&gt;&lt;/a&gt;&lt;b&gt;Motivation&lt;/b&gt;&lt;/h3&gt;
&lt;h4&gt;&lt;a name=&quot;Whoistheaffectedenduser%3F&quot;&gt;&lt;/a&gt;Who is the affected end user?&lt;/h4&gt;
&lt;p&gt;Users using drivers that support client-side operation timeouts, especially users who set low timeouts (1-5 seconds) and run services with high operation volumes (1,000+ op/sec).&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Howdoesthisaffecttheenduser%3F&quot;&gt;&lt;/a&gt;How does this affect the end user?&lt;/h4&gt;
&lt;p&gt;The driver may enter a state where it cannot create any new connections for a long period of time. The user&apos;s services may experience extended outages if that happens.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Howlikelyisitthatthisproblemorusecasewilloccur%3F&quot;&gt;&lt;/a&gt;How likely is it that this problem or use case will occur?&lt;/h4&gt;
&lt;p&gt;Fairly likely for users who set low timeouts (1-5 seconds) and run services with high operation volumes (1,000+ op/sec).&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Iftheproblemdoesoccur%2Cwhataretheconsequencesandhowseverearethey%3F&quot;&gt;&lt;/a&gt;If the problem does occur, what are the consequences and how severe are they?&lt;/h4&gt;
&lt;p&gt;The user&apos;s services may experience extended periods where the driver cannot establish connections and cannot do any work, either at startup or intermittently during the operation of the service.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Isthisissueurgent%3F&quot;&gt;&lt;/a&gt;Is this issue urgent?&lt;/h4&gt;
&lt;p&gt;Must be completed before DRIVERS-555 can be implemented in most drivers.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Isthisticketrequiredbyadownstreamteam%3F&quot;&gt;&lt;/a&gt;Is this ticket required by a downstream team?&lt;/h4&gt;
&lt;p&gt;No.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Isthisticketonlyfortests%3F&quot;&gt;&lt;/a&gt;Is this ticket only for tests?&lt;/h4&gt;
&lt;p&gt;No.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="2061208">DRIVERS-2347</key>
            <summary>Prevent conflating operation timeout with connection establishment timeout</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</priority>
                        <status id="3" iconUrl="https://jira.mongodb.org/images/icons/statuses/inprogress.png" description="This issue is being actively worked on at the moment by the assignee.">In Progress</status>
                    <statusCategory id="4" key="indeterminate" colorName="inprogress"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="shane.harvey@mongodb.com">Shane Harvey</assignee>
                                    <reporter username="matt.dale@mongodb.com">Matt Dale</reporter>
                        <labels>
                    </labels>
                <created>Fri, 3 Jun 2022 01:27:16 +0000</created>
                <updated>Mon, 6 Nov 2023 03:26:17 +0000</updated>
                                                                <component>CMAP</component>
                    <component>CSOT</component>
                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="4592021" author="shane.harvey" created="Fri, 3 Jun 2022 01:35:44 +0000"  >&lt;p&gt;Is this a duplicate of DRIVERS-1801?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10620">
                    <name>Issue split</name>
                                            <outwardlinks description="split to">
                                        <issuelink>
            <issuekey id="2391942">CDRIVER-4681</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391944">CSHARP-4715</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391943">CXX-2712</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391945">GODRIVER-2903</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391946">JAVA-5069</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391948">MOTOR-1151</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391947">NODE-5451</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391951">PHPLIB-1193</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391949">PYTHON-3834</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391952">RUBY-3295</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2391953">RUST-1700</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1766841">GODRIVER-2038</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_10951" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Driver Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10748"><![CDATA[Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_23952" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Driver Compliance</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<style type='text/css'>
         #scriptField, #scriptField *{
                border: 1px solid black;
            }

            #scriptField{
                border-collapse: collapse;
            }

            #scriptField td {
                text-align: center; /* Center-align text in table cells */
            }

            #scriptField td.key {
                text-align: left; /* Left-align text in the Key column */
            }

            #scriptField a {
                text-decoration: none; /* Remove underlines from links */
                border: none; /* Remove border from links */
            }
            
            /* Add green background color to cells with FixVersion */
            #scriptField td.hasFixVersion {
                background-color: #00FF00; /* Green color code */
            }

            /* Center-align the first row headers */
            #scriptField th {
                text-align: center;
            }
        </style>
<table id='scriptField'>
  <tr>
    <th>Key</th>
    <th>Status/Resolution</th>
    <th>FixVersion</th>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/CDRIVER-4681'>CDRIVER-4681</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/CXX-2712'>CXX-2712</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/CSHARP-4715'>CSHARP-4715</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/GODRIVER-2903'>GODRIVER-2903</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/JAVA-5069'>JAVA-5069</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/NODE-5451'>NODE-5451</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/MOTOR-1151'>MOTOR-1151</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/PYTHON-3834'>PYTHON-3834</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/PHPLIB-1193'>PHPLIB-1193</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/RUBY-3295'>RUBY-3295</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
  <tr>
    <td class='key'>
      <a href='https://jira.mongodb.org/browse/RUST-1700'>RUST-1700</a>
    </td>
    <td>Blocked</td>
    <td class=''></td>
  </tr>
</table>]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18362" key="com.atlassian.jira.plugin.system.customfieldtypes:userpicker">
                        <customfieldname>Engineering Lead</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>steve.silvester@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>DRIVERS-555</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_18359" key="com.atlassian.jira.plugin.system.customfieldtypes:userpicker">
                        <customfieldname>Program Manager</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>esha.bhargava@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_21553" key="com.atlassian.jira.plugin.system.customfieldtypes:labels">
                        <customfieldname>Quarter</customfieldname>
                        <customfieldvalues>
                                        <label>FY24Q3</label>
            <label>FY25Q1</label>
    
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr1k1p:hha</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>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_14261" key="com.atlassian.jira.plugin.system.customfieldtypes:datepicker">
                        <customfieldname>Start date</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 12 Oct 2023 00:00:00 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>