<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:36:43 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>[GODRIVER-1589] Consolidate pool.drain() and pool.clear()</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-1589</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;We have separate functions for pool.drain() and pool.clear(), and pool.drain() does not emit a poolCleared event.&#160; These should be the same function and should emit the event.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1325743">GODRIVER-1589</key>
            <summary>Consolidate pool.drain() and pool.clear()</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="13201">Fixed</resolution>
                                        <assignee username="isabella.siu@mongodb.com">Isabella Siu</assignee>
                                    <reporter username="maxime.jimenez@kapten.com">Maxime Jimenez</reporter>
                        <labels>
                    </labels>
                <created>Wed, 22 Apr 2020 13:51:07 +0000</created>
                <updated>Sat, 28 Oct 2023 11:38:12 +0000</updated>
                            <resolved>Tue, 12 May 2020 17:23:30 +0000</resolved>
                                    <version>1.3.1</version>
                                    <fixVersion>1.3.4</fixVersion>
                                    <component>Monitoring</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3080900" author="divjot.arora" created="Tue, 12 May 2020 15:23:16 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=maxime.jimenez%40kapten.com&quot; class=&quot;user-hover&quot; rel=&quot;maxime.jimenez@kapten.com&quot;&gt;maxime.jimenez@kapten.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;We&apos;ve made the code changes for the bug I described in a previous comment. When this is released, you should be able to modify your PoolMonitor to look for PoolCleared events, which indicate that there was a non-transient error that caused the driver to clear out the connection pool for a server.&lt;/p&gt;

&lt;p&gt;As far as the long delay for &lt;tt&gt;ConnectionClosed&lt;/tt&gt; events, expired connections are closed by a goroutine which iterates the connection pool every minute to check which connections are invalid. If the routine has just run, you could wait up to a minute for the next sweep. As I mentioned before, I don&apos;t think ConnectionClosed events are relevant to your use case. If you need to programmatically detect a server shutdown, PoolCleared events are probably the best way to go. However, note that depending on your version of MongoDB, this could provide false positives because older server versions close connections when the primary becomes a secondary. Overall, though, the driver has internal mechanisms to detect and recover from these scenarios, so you might not need any manual detection as I mentioned earlier.&lt;/p&gt;

&lt;p&gt;&amp;#8211; Divjot&lt;/p&gt;</comment>
                            <comment id="3079645" author="xgen-internal-githook" created="Mon, 11 May 2020 21:08:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;iwysiu&apos;, &apos;email&apos;: &apos;isabella.siu@10gen.com&apos;, &apos;username&apos;: &apos;iwysiu&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1589&quot; title=&quot;Consolidate pool.drain() and pool.clear()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1589&quot;&gt;&lt;del&gt;GODRIVER-1589&lt;/del&gt;&lt;/a&gt; fix data race in test (#404)&lt;br/&gt;
Branch: release/1.3&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/a6517472f815a0520562711756c7f726640fd755&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/a6517472f815a0520562711756c7f726640fd755&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3079644" author="xgen-internal-githook" created="Mon, 11 May 2020 21:08:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;iwysiu&apos;, &apos;email&apos;: &apos;isabella.siu@10gen.com&apos;, &apos;username&apos;: &apos;iwysiu&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1589&quot; title=&quot;Consolidate pool.drain() and pool.clear()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1589&quot;&gt;&lt;del&gt;GODRIVER-1589&lt;/del&gt;&lt;/a&gt; consolidate pool.drain and pool.clear (#397)&lt;br/&gt;
Branch: release/1.3&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/6e4f4c5a2d563abb6871eb93cb79edf4ccaab8b4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/6e4f4c5a2d563abb6871eb93cb79edf4ccaab8b4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3079454" author="xgen-internal-githook" created="Mon, 11 May 2020 19:51:11 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;iwysiu&apos;, &apos;email&apos;: &apos;isabella.siu@10gen.com&apos;, &apos;username&apos;: &apos;iwysiu&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1589&quot; title=&quot;Consolidate pool.drain() and pool.clear()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1589&quot;&gt;&lt;del&gt;GODRIVER-1589&lt;/del&gt;&lt;/a&gt; fix data race in test (#404)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/f1f16a1f4d769d844812278841a184ae7f301732&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/f1f16a1f4d769d844812278841a184ae7f301732&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3076352" author="xgen-internal-githook" created="Fri, 8 May 2020 18:35:01 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;iwysiu&apos;, &apos;email&apos;: &apos;isabella.siu@10gen.com&apos;, &apos;username&apos;: &apos;iwysiu&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1589&quot; title=&quot;Consolidate pool.drain() and pool.clear()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1589&quot;&gt;&lt;del&gt;GODRIVER-1589&lt;/del&gt;&lt;/a&gt; consolidate pool.drain and pool.clear (#397)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/a7e237231f5c8de52f0af3036facca0e66cf2fc4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/a7e237231f5c8de52f0af3036facca0e66cf2fc4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3053006" author="divjot.arora" created="Thu, 23 Apr 2020 17:10:42 +0000"  >&lt;p&gt;Thanks for the feedback. I think we have enough information to triage this issue. I&apos;m hoping that we can use this ticket to fix the bug so that &lt;tt&gt;PoolCleared&lt;/tt&gt; events are correctly published and also to update the documentation for &lt;tt&gt;PoolMonitor&lt;/tt&gt; and provide guidance on when specific events are published. Our triage meetings are on Mondays, so I will discuss this ticket with the team at that time.&lt;/p&gt;

&lt;p&gt;&amp;#8211; Divjot&lt;/p&gt;</comment>
                            <comment id="3052992" author="maxime.jimenez@kapten.com" created="Thu, 23 Apr 2020 17:04:12 +0000"  >&lt;p&gt;Thank you for the answer, I&apos;ll check on my side if it&apos;s ok and if the server comes back up on the same address.&lt;/p&gt;

&lt;p&gt;About point 2) yes I don&apos;t understand why we don&apos;t receive any events before a &quot;long&quot; delay (when not performing request, for instance a web server does not receive requests that will triggers mongodb queries) while when we are performing queries, it is showing up immediately. I don&apos;t have much knowledge on how this is handled internally on the driver side though.&lt;/p&gt;

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

&lt;p&gt;Apart from this, I feel like the documentation of the driver is mentioning &quot;background checks&quot; and &quot;background goroutines&quot; but I feel like it is hard to see the big picture in it and if the HeartbeatInterval is linked to this &quot;background goroutine&quot; and to &quot;PoolMonitor&quot; calls. Maybe it could be worth expliciting what is linked and what is not in it.&lt;/p&gt;

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

&lt;p&gt;Maxime&lt;/p&gt;</comment>
                            <comment id="3052979" author="divjot.arora" created="Thu, 23 Apr 2020 16:57:33 +0000"  >&lt;p&gt;Two things:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;As long as the server comes back up at the same address, there&apos;s no action needed on your end to be resilient to restarts. The driver will re-discover the server once it&apos;s back up. In the mean time, requests will not be routed to that server.&lt;/li&gt;
	&lt;li&gt;If you do want to check for server disconnection, you can probably look for &lt;tt&gt;PoolCleared&lt;/tt&gt; events instead of &lt;tt&gt;ConnectionClosed&lt;/tt&gt;. The background monitoring routine should clear the connection pool for the server if there is a connection error during monitoring, which would occur if the server has shutdown. However, I think there may be a bug in this code path that prevents the event from being published, so we&apos;ll triage that bug in our meeting next Monday. I&apos;m hoping to fix that bug under this ticket.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&amp;#8211; Divjot&lt;/p&gt;</comment>
                            <comment id="3052949" author="maxime.jimenez@kapten.com" created="Thu, 23 Apr 2020 16:39:20 +0000"  >&lt;p&gt;Yes, the use case is that we want to be able to make a &lt;em&gt;os.Exit()&lt;/em&gt;&#160;when the server has shutdown.&lt;/p&gt;

&lt;p&gt;The reason why we want to do this is that we will be using MongoAtlas that is managing upgrades of mongodb.&lt;/p&gt;

&lt;p&gt;To do so,&#160;servers are restarted without warning.&lt;/p&gt;

&lt;p&gt;Because of this we must be resilient to a server-side disconnection, and we want to rely on the fact that if we kill our process, it will be restarted automatically connecting to the new server that will be up.&lt;/p&gt;

&lt;p&gt;Let me know if this is not clear.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="3052940" author="divjot.arora" created="Thu, 23 Apr 2020 16:33:03 +0000"  >&lt;p&gt;Can you explain your use case? Are you trying to programmatically tell when the server has shut down? Knowing this would be useful for us when making suggestions.&lt;/p&gt;</comment>
                            <comment id="3052295" author="maxime.jimenez@kapten.com" created="Thu, 23 Apr 2020 08:44:01 +0000"  >&lt;p&gt;Hi Divjot Arora,&lt;/p&gt;

&lt;p&gt;Thanks for the fast answer.&lt;/p&gt;

&lt;p&gt;We are using the driver this way :&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;func NewMongoPoolEventListener(onFailure func()) func(event *mongoEvent.PoolEvent) {&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;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;return&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; func(event *mongoEvent.PoolEvent) {&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;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;if&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; event.Type == mongoEvent.ConnectionClosed {&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;            onFailure()&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;    }&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;}&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;
&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: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// Configuration&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;poolMonitor := mongoEvent.PoolMonitor{        &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;    Event: NewMongoPoolEventListener(onFailure),&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;clientOptions := options.Client().ApplyURI(&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/my-database&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;clientOptions.SetPoolMonitor(&amp;amp;poolMonitor)&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;clientOptions.SetMinPoolSize(uint64(&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;1&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;// After your suggestion, which seems to work&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: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// Connection&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;   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;client, err := mongo.Connect(ctx, clientOptions)&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;While what you suggested seems to work in the end, thank you for that&#160;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/thumbs_up.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;br/&gt;
 I am noticing that I receive the close event after more than &lt;b&gt;45 seconds&lt;/b&gt;&#160;after Mongodb stopped.&lt;br/&gt;
 Would the &lt;em&gt;ClientOptions.SetHeartbeatInterval()&lt;/em&gt; help in this case ?&lt;/p&gt;

&lt;p&gt;In the doc, it is stated that :&lt;br/&gt;
 &lt;em&gt;SetHeartbeatInterval specifies the amount of time to wait between periodic background server checks.&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;Is that the periodic background that is mentioned in &lt;em&gt;Connect()&lt;/em&gt; doc as &lt;em&gt;The Client.Connect method starts background goroutines to monitor the state of the deployment&lt;/em&gt;?&lt;/p&gt;

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

&lt;p&gt;Is this the same periodic background goroutine that is used for &lt;em&gt;PoolMonitor&lt;/em&gt;&#160;?&lt;/p&gt;

&lt;p&gt;Thanks&lt;br/&gt;
 Maxime&lt;/p&gt;</comment>
                            <comment id="3051519" author="divjot.arora" created="Wed, 22 Apr 2020 18:26:28 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=maxime.jimenez%40kapten.com&quot; class=&quot;user-hover&quot; rel=&quot;maxime.jimenez@kapten.com&quot;&gt;maxime.jimenez@kapten.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for the report. Can you provide some more information so we can accurately triage this ticket? What is your monitor configured to do? Is it only looking for ConnectionClosed events?&lt;/p&gt;

&lt;p&gt;If you initialize a &lt;tt&gt;mongo.Client&lt;/tt&gt; with the default settings, run no operations, and then call &lt;tt&gt;Disconnect&lt;/tt&gt;, I think this behavior is expected. This is because the first connection is created when the first operation is executed. You can change this by using the &lt;tt&gt;ClientOptions.SetMinPoolSize&lt;/tt&gt; option, which will populate the pool in the background.&lt;/p&gt;

&lt;p&gt;&amp;#8211; Divjot&lt;/p&gt;</comment>
                    </comments>
                    <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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hus207:</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>