<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:48 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>[JAVA-3928] Connection pool paused state </title>
                <link>https://jira.mongodb.org/browse/JAVA-3928</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description></description>
                <environment></environment>
        <key id="1585347">JAVA-3928</key>
            <summary>Connection pool paused state </summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="13201">Fixed</resolution>
                                        <assignee username="valentin.kovalenko@mongodb.com">Valentin Kavalenka</assignee>
                                    <reporter username="esha.bhargava@mongodb.com">Esha Bhargava</reporter>
                        <labels>
                    </labels>
                <created>Sun, 10 Jan 2021 23:20:28 +0000</created>
                <updated>Sat, 28 Oct 2023 11:21:29 +0000</updated>
                            <resolved>Mon, 27 Sep 2021 19:17:26 +0000</resolved>
                                                    <fixVersion>4.4.0</fixVersion>
                                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4087405" author="xgen-internal-githook" created="Mon, 27 Sep 2021 18:42:42 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Valentin Kovalenko&apos;, &apos;email&apos;: &apos;valentin.kovalenko@mongodb.com&apos;, &apos;username&apos;: &apos;stIncMale&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3928&quot; title=&quot;Connection pool paused state &quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3928&quot;&gt;&lt;del&gt;JAVA-3928&lt;/del&gt;&lt;/a&gt; Make `DefaultConnectionPool` pausable (#701)&lt;/p&gt;

&lt;p&gt;Following are the details regarding the `createSessions` parameter in the constructor of `AbstractUnifiedTest`.&lt;br/&gt;
The parameter was introduced to work around a race condition in the test&lt;br/&gt;
`minPoolSize-error.json`: &quot;Network error on minPoolSize background creation&quot;.&lt;br/&gt;
1) The test format according to&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/specifications/tree/master/source/server-discovery-and-monitoring/tests#test-format&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/specifications/tree/master/source/server-discovery-and-monitoring/tests#test-format&lt;/a&gt;&lt;br/&gt;
is specified in&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.rst#test-format&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.rst#test-format&lt;/a&gt;.&lt;br/&gt;
2) The aforementioned format specifies the following steps:&lt;br/&gt;
  &quot;9. Create a new MongoClient client ... Pass this test&apos;s clientOptions if present.&lt;br/&gt;
  10. Call client.startSession twice to create ClientSession objects session0 and session1&quot;.&lt;br/&gt;
3) Once a mongo client is created, it starts a monitor, successfully executes `isMaster`&lt;br/&gt;
because the first 3 commands in the test are allowed to succeed (``&quot;skip&quot;: 3`), and unpauses the pool.&lt;br/&gt;
4) The pool&apos;s background thread is notified about the fact that the pool is unpaused&lt;br/&gt;
and starts populating the pool because the test specifies ``&quot;minPoolSize&quot;: 10`.&lt;br/&gt;
5) Concurrently with 4), the test runner tries to create `session0` and `session1` as per 2).&lt;br/&gt;
If the pool&apos;s background thread is lucky, it consumes one or both of the allowed success results&lt;br/&gt;
that are left (``&quot;skip&quot;: 3`), and the test fails because it cannot create either one or both sessions.&lt;/p&gt;

&lt;p&gt;I somewhat verified this scenario by introducing an artificial delay&lt;br/&gt;
either in the pool&apos;s background thread (right before it starts creating connections to populate the pool),&lt;br/&gt;
or in the test runner right before it creates sessions. Depending on where I put the delay,&lt;br/&gt;
I can either make the test regularly pass, or regularly fail by failing to create the sessions.&lt;br/&gt;
There is no way to eliminate this race condition in the test without introducing a handle to control the pool&apos;s&lt;br/&gt;
background thread and the server monitor outside of a client. However, my understanding is that many of our&lt;br/&gt;
integration tests are racy, and we reduce the probability of unwanted outcomes by introducing delays in tests.&lt;br/&gt;
In this specific case, we already have a delay for the monitor thread after its first `isMaster`&lt;br/&gt;
(`&quot;heartbeatFrequencyMS&quot;: 10000`), and it seems like we need to have something like&lt;br/&gt;
`&quot;maintenanceInitialDelayMS&quot;: 2000` for the pool&apos;s background thread.&lt;br/&gt;
With this option the test passes regularly, though it still obviously has a race condition.&lt;/p&gt;

&lt;p&gt;Not all drivers implement a pool option similar to `maintenanceInitialDelayMS`,&lt;br/&gt;
so instead of changing the spec and forcing everyone to have one,&lt;br/&gt;
I changed the test runner so that it does not create `session0` and `session1` for SDAM tests,&lt;br/&gt;
which do not use these sessions anyway.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3928&quot; title=&quot;Connection pool paused state &quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3928&quot;&gt;&lt;del&gt;JAVA-3928&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/17b2f91fd1c6957a0da3457616f287fd08ad89d0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/17b2f91fd1c6957a0da3457616f287fd08ad89d0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4087404" author="mms-build@10gen.com" created="Mon, 27 Sep 2021 18:42:41 +0000"  >&lt;p&gt; &lt;a href=&quot;https://github.com/stIncMale&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stIncMale&lt;/a&gt; merged a pull request (&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/701&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;JAVA-3928 Make `DefaultConnectionPool` pausable&lt;/a&gt;) into the following branch:&lt;br/&gt;
                       master: &lt;a href=&quot;https://github.com/stIncMale/mongo-java-driver/commit/17b2f91fd1c6957a0da3457616f287fd08ad89d0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;17b2f91fd1c6957a0da3457616f287fd08ad89d0&lt;/a&gt;&lt;/p&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                                        </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="1637148">JAVA-4028</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10423">
                    <name>Gantt End to End</name>
                                            <outwardlinks description="has to be finished together with">
                                        <issuelink>
            <issuekey id="1699843">JAVA-4133</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1700645">JAVA-4134</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1700658">JAVA-4135</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1700691">JAVA-4136</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1700733">JAVA-4137</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1700748">JAVA-4138</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="has to be finished together with">
                                        <issuelink>
            <issuekey id="1774852">JAVA-4193</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                        <issuelink>
            <issuekey id="1976776">JAVA-4471</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1970791">JAVA-4452</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1978981">JAVA-4483</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10257" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Documentation Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11861"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>JAVA-3890</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_21553" key="com.atlassian.jira.plugin.system.customfieldtypes:labels">
                        <customfieldname>Quarter</customfieldname>
                        <customfieldvalues>
                                        <label>FY22Q4</label>
    
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr3mi7:</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>