<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:24:47 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-2126] Drivers should check out an implicit session only after checking out a connection</title>
                <link>https://jira.mongodb.org/browse/DRIVERS-2126</link>
                <project id="10980" key="DRIVERS">Drivers</project>
                    <description>&lt;p&gt;Problem:&lt;br/&gt;
When the number of concurrent application requests are larger than the number of available connections, the driver may generate many more implicit sessions than connections. For example with maxPoolSize=1 and 100 threads, 100 implicit sessions may be created. This increases the load on the server since session state is cached in memory. In the worst case this kind of workload can hit the session limit and trigger TooManyLogicalSessions.&lt;/p&gt;

&lt;p&gt;Proposed solution:&lt;br/&gt;
Drivers should check out an implicit session &lt;em&gt;only after checking out a connection&lt;/em&gt;. This change will limit the number of implicit sessions to no greater than an application&apos;s maxPoolSize (ignoring operations that hold on to the session like cursors).&lt;/p&gt;

&lt;p&gt;This change would not have any effect on explicit sessions created with startSession.&lt;/p&gt;</description>
                <environment></environment>
        <key id="946221">DRIVERS-2126</key>
            <summary>Drivers should check out an implicit session only after checking out a connection</summary>
                <type id="14901" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14700&amp;avatarType=issuetype">Spec Change</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="shane.harvey@mongodb.com">Shane Harvey</reporter>
                        <labels>
                            <label>driver-planning-backlog</label>
                    </labels>
                <created>Mon, 30 Sep 2019 18:26:14 +0000</created>
                <updated>Wed, 9 Mar 2022 19:06:01 +0000</updated>
                            <resolved>Wed, 9 Mar 2022 19:05:41 +0000</resolved>
                                                        <component>Sessions</component>
                                        <votes>1</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="4401743" author="shane.harvey" created="Wed, 9 Mar 2022 19:06:01 +0000"  >&lt;p&gt;Yes this is a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS-1030&quot; title=&quot;Drivers should check out an implicit session only after checking out a connection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DRIVERS-1030&quot;&gt;&lt;del&gt;DRIVERS-1030&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="4401524" author="jmikola@gmail.com" created="Wed, 9 Mar 2022 18:01:28 +0000"  >&lt;p&gt;Is this ticket a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS-1030&quot; title=&quot;Drivers should check out an implicit session only after checking out a connection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DRIVERS-1030&quot;&gt;&lt;del&gt;DRIVERS-1030&lt;/del&gt;&lt;/a&gt;? That issue is currently being implemented while this is in the backlog, and both appear to have the same description.&lt;/p&gt;</comment>
                            <comment id="3035458" author="matt.broadstone" created="Fri, 10 Apr 2020 19:37:02 +0000"  >&lt;p&gt;One way I&apos;ve been able to work around this in the Node.js driver is to make a &lt;tt&gt;ClientSession&lt;/tt&gt; lazily bind to a &lt;tt&gt;ServerSession&lt;/tt&gt;, but the sessions specification explicitly states: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A ``ClientSession`` MUST be associated with a ``ServerSession`` at the time ``startSession`` is called.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;We&apos;re still technically complying with this requirement because the session is acquired as soon as it is inspected (either by a user to save off the &lt;tt&gt;lsid&lt;/tt&gt;, or the driver when it needs to apply the session to an operation), but I think it&apos;s a bit of a grey area. We might consider loosening this requirement in the sessions spec as part of this work, or at least introduce rationale for why early binding is required and necessary.&lt;/p&gt;</comment>
                            <comment id="3033968" author="shane.harvey" created="Thu, 9 Apr 2020 19:45:16 +0000"  >&lt;p&gt;I still agree with the proposed solution but I want to point out that this statement is not true in all cases:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;This change will limit the number of implicit sessions to no greater than an application&apos;s maxPoolSize (ignoring operations that hold on to the session like cursors).&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The issue is that an implicit server session remains checked out even after the connection is checked in. (The session&apos;s lifetime needs to outlive the connection in order to support retryable writes.) So there is a race where more than maxPoolSize implicit server sessions can be created. However, this race is much more rare because checking in a connection should be very fast and would cause very few (if any) extra sessions.&lt;/p&gt;</comment>
                            <comment id="2464471" author="shane.harvey" created="Thu, 3 Oct 2019 20:48:52 +0000"  >&lt;p&gt;Note I think an implementation of this could be quite simple with only the following changes:&lt;br/&gt;
 1) Do not assign a ServerSession when creating an implicit ClientSession.&lt;br/&gt;
 2) Assign a ServerSession to the implicit ClientSession (if one is not already assigned) after checking out the connection.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="1307488">DRIVERS-1030</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="925812">NODE-2216</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1307488">DRIVERS-1030</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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr6kdj:</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>