<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:48:27 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-4513] Problem with MonitorServer heartbeat threads.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4513</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary%3A&quot;&gt;&lt;/a&gt;Summary:&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;When you once created a client and created a connection to one server/cluster the thread that performs heartbeat (that lives in MongoDB.Driver.Core.Servers.MonitorServer class) will be working all the time before the application stop.&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Versiontoreproduce%3A&quot;&gt;&lt;/a&gt;Version to reproduce:&lt;/h4&gt;

&lt;p&gt;From 2.15.0 (thread was added in &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-3761&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-3761&lt;/a&gt;) to the latest (2.19.0).&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce%3A&quot;&gt;&lt;/a&gt;How to Reproduce:&lt;/h4&gt;
&lt;ol&gt;
	&lt;li&gt;Create MongoClient with connection to some server/cluster.&lt;/li&gt;
	&lt;li&gt;Delete MongoClient (MongoClient is out of scope and maybe will be destroyed sometimes when GC will decide)&lt;/li&gt;
	&lt;li&gt;We don&apos;t need Mongo connection, but the heartbeat thread is working. And we can&apos;t control it.&lt;/li&gt;
&lt;/ol&gt;


&lt;h4&gt;&lt;a name=&quot;AdditionalBackground%3A&quot;&gt;&lt;/a&gt;Additional Background:&lt;/h4&gt;

&lt;p&gt;That&apos;s how look threads list in our application after some time, there are 300+ threads created by &lt;em&gt;MonitorServer&lt;/em&gt; and they never die.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://asana-user-private-us-east-1.s3.amazonaws.com/assets/8050725593772/1203194407506236/657c644d26806aa4989c4efb84737858?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEFgaCXVzLWVhc3QtMSJGMEQCIB2dH45Mzbc2dkKINJulYIK71zIUxqtt5h81l2TDhWR6AiBQ3LcJqkQJMX6uM9Zi0F9iqABIN9WL4z9eR4XB7AsaqCrVBAjR%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDQwMzQ4MzQ0Njg0MCIMWXpgGgzAzl%2FXfFZ%2BKqkEsnMp6b3CGz5fD6VBb%2B%2BugrlDzDW3iH5Y6zz1I0cQMu80b9vwc4ykbGX%2FyJXIO0ODcMMVBYrt6w7oAFR95zl8LkMIjMW8xGgp9TdsHE98NC1emKaXCekd3xGDeDku%2BLUlEOk0qo0TNYWIbSW0ZA5%2BgpV8Pu0vQM%2Bvkt2d7HiIXXF3DhOZgJF%2B2%2BAaVJE14gdKZckB8pkLefTlskRFW0fIb0Lz3DTg0M1dk5PkeL00H52cGr9WoqByP37l%2FcdQLucUbVqppVWIsqYsEIEwovTJpva2JbdA80ighVmNWOkErzTUJod1qmYgFUyU8V0K1ab82bt6ZICeTtE8EXQngSjyqY2qRxn19dc2HZXhwJGgJNz%2FT0ATllsjnKZKltXYnzzVIAnVhgdytXvYZ97qRHV5phLdPFv55zuKZWCvztqzWgZ%2BQ%2FPAp26C72fnd7Msxrfkaqah6QXkBdQPK8wRFR3MH4%2FH0Sj34FHJtdmbLCkqUI7StulK5onGIs8XObAsgJ1mL7UtMLu8pUMESgfKygSpdFQBFnm6XnpI3eihtDJhC%2FcUKn4a%2F7i0gLZNDz1Tz1l6aMWLrsxZn7DdbnObHucQsAiCyWyZcEUup4mPSIIk6qzXvqFXW7%2FBiEZ1DytGHVEbRhIS4AIxIFGA6O%2BCwDVJGZTOrlxi7xm32Orzy0ZRY7depLLDg0hKI0NN7viTrVsAVIpA01iMYyBgaOzSBPpqfuLhryp2mZhB5DDgye2eBjqqAXdOsbV19BHoqiHUnBNauYF%2B0XOZBFYk7DQHHRYfCUezi7MThl95QaCP0yUsRo6KXH91XpM%2F7IBO2nC%2F18l0TtdXMOo7eQt7rPDGHWckx2Pq%2FXWB7rpmslpcYHjTnMNp5TYryw0D9B%2FwAlQxqyGSvgHjnEwSSQbcLbpGTI6tioO%2BdukHsu4PH9o4k4dLRnVntvN5g1mktv4119OcjS6kQG7NFEApC0k8Vh9j&amp;amp;X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;amp;X-Amz-Date=20230202T080455Z&amp;amp;X-Amz-SignedHeaders=host&amp;amp;X-Amz-Expires=120&amp;amp;X-Amz-Credential=ASIAV34L4ZY4DP4TH6PP%2F20230202%2Fus-east-1%2Fs3%2Faws4_request&amp;amp;X-Amz-Signature=5482af2be8ab96d2cc99b924c6596faeab23908bf45bd1dd27ae2748ce97ffe6#_=_&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;A lot of connections exist which never close.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.mongodb.org/secure/attachment/429585/429585_image-2023-02-02-10-08-20-460.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2250441">CSHARP-4513</key>
            <summary>Problem with MonitorServer heartbeat threads.</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="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="james.kovacs@mongodb.com">James Kovacs</assignee>
                                    <reporter username="semyon@365scores.com">Semyon Pivovarov</reporter>
                        <labels>
                    </labels>
                <created>Thu, 2 Feb 2023 08:11:19 +0000</created>
                <updated>Tue, 7 Feb 2023 21:17:07 +0000</updated>
                            <resolved>Tue, 7 Feb 2023 21:17:07 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="5176056" author="james.kovacs" created="Tue, 7 Feb 2023 21:16:44 +0000"  >&lt;p&gt;Hi, Simon,&lt;/p&gt;

&lt;p&gt;Thank you for reporting this issue. Unfortunately the fix is not as straightforward as you describe. If you create multiple &lt;tt&gt;MongoClient&lt;/tt&gt; instances using the same (or similar) connection strings (determined by matching &lt;tt&gt;ClusterKey&lt;/tt&gt;), they use the same underlying cluster and connection pools. Disposing one &lt;tt&gt;MongoClient&lt;/tt&gt; instance could break other &lt;tt&gt;MongoClient&lt;/tt&gt; instances. There is an additional race condition that occurs when you dispose of a &lt;tt&gt;Cluster&lt;/tt&gt; and then create a new one with the same &lt;tt&gt;ClusterKey&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;I have closed this issue as a duplicate of &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;, which is an existing ticket to make &lt;tt&gt;MongoClient&lt;/tt&gt; be disposable. Please follow that ticket for updates. Note that this is a breaking change and is planned for the 3.0 release of the driver.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
James&lt;/p&gt;</comment>
                            <comment id="5166929" author="esha.bhargava" created="Fri, 3 Feb 2023 20:09:01 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=semyon%40365scores.com&quot; class=&quot;user-hover&quot; rel=&quot;semyon@365scores.com&quot;&gt;semyon@365scores.com&lt;/a&gt; Thank you for reporting this issue. We&apos;ll look into it and get back to you soon.&lt;/p&gt;</comment>
                            <comment id="5161422" author="JIRAUSER1272721" created="Thu, 2 Feb 2023 08:18:52 +0000"  >&lt;p&gt;Created PR with suggestions to fix: &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/pull/1018&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/pull/1018&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="1627800">CSHARP-3431</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1827772">CSHARP-3761</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="429585" name="image-2023-02-02-10-08-20-460.png" size="162034" author="semyon@365scores.com" created="Thu, 2 Feb 2023 08:08:21 +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_14266" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Documentation Changes Summary</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;1.  What would you like to communicate to the user about this feature?&lt;br/&gt;
2.  Would you like the user to see examples of the syntax and/or executable code and its output?&lt;br/&gt;
3.  Which versions of the driver/connector does this apply to?&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i1c1yg:</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>