<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:47:07 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>[CSHARP-4064] Connection TCP ports are not free&apos;d</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4064</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;We upgraded to MongoDB&#160;c# driver 2.13.3 and noticed a huge increase in open ports. There doesn&apos;t seem to be a &quot;cleanup&quot; / &quot;free&quot; action running. This means the ports are only growing. And since windows has like a port limit (around 16K) that limit is reached after a few days&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When analyzing, I&#160;see that ports are kept in state &quot;Established&quot;, and never freed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;After downgrading to 2.10.3, I see that ports are used in the same way. But the biggest difference is that in 2.10.3 I see that ports are &quot;freed&quot; (put on Time Waiting) and then after some time freed to the system.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160;__&#160;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Pleaseprovidetheversionofthedriver.Ifapplicable%2CpleaseprovidetheMongoDBserverversionandtopology%28standalone%2Creplicaset%2Corshardedcluster%29.&quot;&gt;&lt;/a&gt;Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).&lt;/h4&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce&quot;&gt;&lt;/a&gt;How to Reproduce&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;You can reproduce it with a simple test app that needs to be in waiting mode so the connection idle event can close the connections.&lt;/em&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Use a tool like CurrPorts to see the port usage of the application. Switching the versions you will see the difference right away.&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;AdditionalBackground&quot;&gt;&lt;/a&gt;Additional Background&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;For us this is quite important since we are using a multi tenant database setup, where each customer has it&apos;s own database with credentials. This means we have a lot of connections (since the drivers creates a pool per clusterkey/database/username/password combination&lt;/em&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1985336">CSHARP-4064</key>
            <summary>Connection TCP ports are not free&apos;d</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="13203">Gone away</resolution>
                                        <assignee username="james.kovacs@mongodb.com">James Kovacs</assignee>
                                    <reporter username="dennis@valueblue.nl">Dennis Hoefakker</reporter>
                        <labels>
                    </labels>
                <created>Thu, 17 Feb 2022 08:39:12 +0000</created>
                <updated>Fri, 27 Oct 2023 19:56:03 +0000</updated>
                            <resolved>Fri, 9 Sep 2022 12:00:38 +0000</resolved>
                                    <version>2.13.3</version>
                                                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="4814196" author="dbeng-pm-bot" created="Fri, 9 Sep 2022 12:00:40 +0000"  >&lt;p&gt;There hasn&apos;t been any recent activity on this ticket, so we&apos;re resolving it. Thanks for reaching out! Please feel free to comment on this if you&apos;re able to provide more information.&lt;/p&gt;</comment>
                            <comment id="4777476" author="james.kovacs" created="Thu, 25 Aug 2022 18:44:33 +0000"  >&lt;p&gt;Hi, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dennis%40valueblue.nl&quot; class=&quot;user-hover&quot; rel=&quot;dennis@valueblue.nl&quot;&gt;dennis@valueblue.nl&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for the additional details regarding your multi-tenant setup.&lt;/p&gt;

&lt;p&gt;As you note, connections are pooled based on the cluster key, which includes the authenticating user. Connection establishment involves many steps including TCP socket setup, TLS handshake, and authentication. Authentication is relatively expensive by design (involving many rounds of credential hashing) to discourage brute force attacks. Thus pooling connections irregardless of authenticating user and re-authenticating before every operation would increase the operation time for every MongoDB operation.&lt;/p&gt;

&lt;p&gt;Regarding the monitoring threads used by the driver. MongoDB implemented streaming heartbeats in MongoDB 4.4 to reduce failover times during elections. This was implemented by the driver in 2.11 (&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2964&quot; title=&quot;Reduce Client Time To Recovery On Topology Changes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2964&quot;&gt;&lt;del&gt;CSHARP-2964&lt;/del&gt;&lt;/a&gt;) as Boris mentioned earlier. Using the new streaming heartbeats, a driver establishes a monitoring connection and then waits for push notifications of topology changes from the cluster members. The problem is that we have no way to measure round-trip time to cluster members, which is required when making server selection decisions. Thus a second monitoring thread (the RTT thread) is established which measures the round-trip time to the cluster member. That is why you saw the doubling of idle monitoring threads when moving from 2.10 (which doesn&apos;t support streaming heartbeats) to 2.13 (which does). Unfortunately there is no way to disable this behaviour in newer drivers.&lt;/p&gt;

&lt;p&gt;We are planning to make &lt;tt&gt;MongoClient&lt;/tt&gt; disposable in the 3.0.0 release (&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-3431&quot; title=&quot;Make MongoClient IDisposable to allow short lifetime scope usage&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-3431&quot;&gt;CSHARP-3431&lt;/a&gt;) but that release is a ways off and plans/priorities may change. A truly disposable &lt;tt&gt;MongoClient&lt;/tt&gt; is likely the best solution for a multi-tenant situation such as yours as all resources associated with the &lt;tt&gt;MongoClient&lt;/tt&gt; will be properly cleaned up and you can implement some sort of &lt;tt&gt;MongoClient&lt;/tt&gt; caching mechanism based on your tenants&apos; usage statistics.&lt;/p&gt;

&lt;p&gt;In the meantime we do use a disposable &lt;tt&gt;MongoClient&lt;/tt&gt; in our tests. See &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/master/tests/MongoDB.Driver.TestHelpers/DisposableMongoClient.cs&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;DisposableMongoClient&lt;/a&gt; in &lt;tt&gt;MongoDB.Driver.TestHelpers&lt;/tt&gt;. I wouldn&apos;t recommend using this class directly, but more as an example of how the &lt;tt&gt;Dispose&lt;/tt&gt; method cleans up resources - notably &lt;tt&gt;ClusterRegistry.Instance.UnregisterAndDisposeCluster(mongoClient.Cluster)&lt;/tt&gt;. I will admit that this method was designed with testing purposes in mind and not production. I would strongly recommend testing appropriately if you are going to use it in your multi-tenant application.&lt;/p&gt;

&lt;p&gt;Hopefully this provides you with some guidance and ideas of how to address this issue both now and in the future.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
James&lt;/p&gt;</comment>
                            <comment id="4756633" author="JIRAUSER1269916" created="Wed, 17 Aug 2022 08:57:20 +0000"  >&lt;p&gt;Hi @Boris,&lt;/p&gt;

&lt;p&gt;Sorry for the late reply, this issue slipped, also caused we reverted back to driver 2.10.3.&lt;/p&gt;

&lt;p&gt;You remark for &quot;MongoClient per cluster&quot; is something we already do. But our multi-tenant setup enforces us to have a user/password per database. And since the MongoClient is unique per server/database/user/password this causes a huge connection pool(s).&lt;/p&gt;

&lt;p&gt;Is there a way to tell the new driver to use one connection, or tell the driver to free connections to the OS quicker. I also have an other bug &#160;CSHAP-3250 which explains.&lt;/p&gt;</comment>
                            <comment id="4426281" author="dbeng-pm-bot" created="Tue, 22 Mar 2022 12:00:39 +0000"  >&lt;p&gt;There hasn&apos;t been any recent activity on this ticket, so we&apos;re resolving it. Thanks for reaching out! Please feel free to comment on this if you&apos;re able to provide more information.&lt;/p&gt;</comment>
                            <comment id="4392655" author="JIRAUSER1257742" created="Fri, 4 Mar 2022 21:34:32 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dennis%40valueblue.nl&quot; class=&quot;user-hover&quot; rel=&quot;dennis@valueblue.nl&quot;&gt;dennis@valueblue.nl&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The described behavior is expected. Each MongoClient maintains two open connections for each server, in addition to the connections used by operations. This change was introduced in 2.11 &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2964&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;CSHARP-2964&lt;/a&gt;, while in previous versions MongoClient maintained one connection per server.&lt;/p&gt;

&lt;p&gt;For better performance, it&#8217;s highly recommended having a single &lt;a href=&quot;https://mongodb.github.io/mongo-csharp-driver/2.14/getting_started/quick_tour/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoClient per cluster across your application&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="4387230" author="JIRAUSER1257742" created="Wed, 2 Mar 2022 18:32:36 +0000"  >&lt;p&gt;Thank you &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dennis%40valueblue.nl&quot; class=&quot;user-hover&quot; rel=&quot;dennis@valueblue.nl&quot;&gt;dennis@valueblue.nl&lt;/a&gt;,&lt;br/&gt;
We will try to reproduce this issue.&lt;/p&gt;</comment>
                            <comment id="4386141" author="JIRAUSER1269916" created="Wed, 2 Mar 2022 13:41:07 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Sorry for the delay but i enclosed a simple example. I cleaned the solution&apos;s packages folder so you need to restore nuget packages and other refs using the following command:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;When running the project, supply the connection string in the class &quot;TenantMongoClientLocator&quot; I didn&apos;t bother putting it in config files &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/wink.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;trigger a DocumentCount using the request:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;https:&lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;//localhost:44333/api/test?databaseName=%YourDatabasename%&amp;amp;collectionName=%YourCollectionname%&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;What you will notice (after triggering the command above )using currPorts is that running 2.10.3 you see 2 connections to the db server, and after a while it&apos;s reduces to 1. When running the 2.13.3 you&apos;ll see 3 connections to the db server reducing to 2. Which is double open connections.&lt;/p&gt;

&lt;p&gt;As stated before we are using multiple databases per customer with own credentials, running multiple microservices on a VM, where the micro&apos;s can have connections to the database.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/attachment/363559/363559_MongoTcpConnectionTest.zip&quot; title=&quot;MongoTcpConnectionTest.zip attached to CSHARP-4064&quot;&gt;MongoTcpConnectionTest.zip&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</comment>
                            <comment id="4376689" author="JIRAUSER1269916" created="Fri, 25 Feb 2022 13:21:42 +0000"  >&lt;p&gt;Yes i&apos;ll set up an example, was a bit busy this week but will work on it next week!&lt;/p&gt;</comment>
                            <comment id="4364625" author="JIRAUSER1257742" created="Fri, 18 Feb 2022 18:28:37 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dennis%40valueblue.nl&quot; class=&quot;user-hover&quot; rel=&quot;dennis@valueblue.nl&quot;&gt;dennis@valueblue.nl&lt;/a&gt; , thank you for your bug report.&lt;/p&gt;

&lt;p&gt;I failed to reproduce this issue with the following code:&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var mongoUrl = MongoUrl.Create(@&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;mongodb://localhost:27017&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var clientSettings = MongoClientSettings.FromUrl(mongoUrl);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;clientSettings.MaxConnectionLifeTime = TimeSpan.FromSeconds(&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;60&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// 5&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;clientSettings.MinConnectionPoolSize = &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// 10&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;clientSettings.ClusterConfigurator += b =&amp;gt;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; &#160;b.ConfigureConnectionPool(s =&amp;gt; s.With(maintenanceInterval: TimeSpan.FromSeconds(&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;)); &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// 60, 120&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;};&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var client = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; MongoClient(clientSettings);&#160;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;await Task.Delay(TimeSpan.FromMinutes(&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;120&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;));&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I have tried 2.13.3 and 2.14.1 drivers, with various heartbeat intervals, max connection lifetimes and pool sizes. Running the sample for an hour, I can see that the connections are established and freed as expected via &lt;em&gt;CurrPorts .&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To investigate further it would be helpful to receive a self-contained sample code which reproduces the issue.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="363559" name="MongoTcpConnectionTest.zip" size="7795060" author="dennis@valueblue.nl" created="Wed, 2 Mar 2022 13:34:13 +0000"/>
                    </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|hr48xi:k</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>