<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:36:44 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-1598] Connection pool events should return the number of active connections</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-1598</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Connection pool events should return the number of connections. Right now there&apos;s no way for clients to get visibility into the number of active connections in the go driver.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1333376">GODRIVER-1598</key>
            <summary>Connection pool events should return the number of active connections</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="13200">Declined</resolution>
                                        <assignee username="divjot.arora@mongodb.com">Divjot Arora</assignee>
                                    <reporter username="ajo@stripe.com">AJ Ortega</reporter>
                        <labels>
                    </labels>
                <created>Wed, 29 Apr 2020 22:37:25 +0000</created>
                <updated>Fri, 25 Aug 2023 13:31:05 +0000</updated>
                            <resolved>Tue, 9 Jun 2020 15:44:39 +0000</resolved>
                                                                    <component>Connections</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3197404" author="divjot.arora" created="Tue, 9 Jun 2020 15:44:39 +0000"  >&lt;p&gt;I&apos;m moving this to &quot;Closed&quot; because we haven&apos;t heard anything and the issue of ConnectionClosed events not being published will be addressed in &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1609&quot; title=&quot;ConnectionClosed events not published when pool is disconnecting&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1609&quot;&gt;&lt;del&gt;GODRIVER-1609&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="3075197" author="divjot.arora" created="Fri, 8 May 2020 02:32:05 +0000"  >&lt;p&gt;I have tried to do this on my own. I noticed that there was an issue with ConnectionClosed events being missed when the pool is being disconnected and have filed &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1609&quot; title=&quot;ConnectionClosed events not published when pool is disconnecting&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1609&quot;&gt;&lt;del&gt;GODRIVER-1609&lt;/del&gt;&lt;/a&gt; to fix that.&lt;/p&gt;

&lt;p&gt;I didn&apos;t see any issues with &lt;tt&gt;ConnectionCreated&lt;/tt&gt; events though. One thing I noted from your logs is the &lt;tt&gt;ConnectionCreatedEvent&lt;/tt&gt; reports a connection count of&#160;18446744073709551612. The first &lt;tt&gt;ConnectionClosed&lt;/tt&gt; event shows count&#160;18446744073709551611, which makes sense. The next four ConnectionClosed events actually show an increasing count (18446744073709551612 -&#160;18446744073709551615). That suggests that the atomic is being incremented, which would only happen in your monitor if a &lt;tt&gt;ConnectionCreated&lt;/tt&gt; event was published. Any idea what&apos;s going on there?&lt;/p&gt;

&lt;p&gt;Also, those numbers are very high. Are that many connections actually being created or is this an overflow/underflow issue?&lt;/p&gt;</comment>
                            <comment id="3074942" author="ajo@stripe.com" created="Thu, 7 May 2020 23:15:02 +0000"  >&lt;p&gt;Have you tried to make your own connection counter and verify that it works? I also audited the code, but my connection counts are clearly incorrect.&lt;/p&gt;</comment>
                            <comment id="3073986" author="divjot.arora" created="Thu, 7 May 2020 15:01:59 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ajo%40stripe.com&quot; class=&quot;user-hover&quot; rel=&quot;ajo@stripe.com&quot;&gt;ajo@stripe.com&lt;/a&gt; I haven&apos;t had any luck figuring out why ConnectionCreated events wouldn&apos;t be firing. Connections are either created in a background pooling routine if &lt;tt&gt;MinPoolSize&lt;/tt&gt; is specified or during an application operation if the pool is empty. In both cases, the code goes through &lt;tt&gt;topology/pool.makeNewConnection&lt;/tt&gt; (&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/topology/pool.go#L270&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/topology/pool.go#L270&lt;/a&gt;), which fires a &lt;tt&gt;ConnectionCreatedEvent&lt;/tt&gt; as long as &lt;tt&gt;newConnection&lt;/tt&gt; succeeds. Note that &lt;tt&gt;newConnection&lt;/tt&gt; only creates an in-memory type and does not actually do the network I/O needed to handshake/authenticate the connection, so it would only fail if the connection were mis-configured, which is very unlikely. If that were the case, no connections would be created successfully because they all use the same configuration.&lt;/p&gt;

&lt;p&gt;Do you have any more information that might be helpful in debugging this issue?&lt;/p&gt;</comment>
                            <comment id="3071029" author="divjot.arora" created="Wed, 6 May 2020 00:23:36 +0000"  >&lt;p&gt;Thanks for the extra information &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ajo%40stripe.com&quot; class=&quot;user-hover&quot; rel=&quot;ajo@stripe.com&quot;&gt;ajo@stripe.com&lt;/a&gt;. If &lt;tt&gt;ConnectionCreated&lt;/tt&gt; events are not being published, that seems like a bug. There should be one ConnectionCreated event per ConnectionClosed event. I&apos;ll investigate this a bit more tomorrow. Can you provide the driver version you&apos;re using?&lt;/p&gt;</comment>
                            <comment id="3070969" author="ajo@stripe.com" created="Tue, 5 May 2020 23:29:51 +0000"  >&lt;p&gt;A quick update: we attempted to use the connection pool events as described, but there seem to be missing ConnectionCreated events, preventing an accurate count.&lt;/p&gt;

&lt;p&gt;Our monitor looks like the following:&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;// This monitor will log events.&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;func getPoolMonitor(*event.PoolMonitor) *event.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;	connectionCount := atomic.NewUint64(0)&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;	return &amp;amp;event.PoolMonitor{Event: func(poolEvent *event.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;		connections := uint64(0)&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;		switch poolEvent.Type {&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;		case event.ConnectionCreated:&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;			connections = connectionCount.Inc()&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;		case event.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;			connections = connectionCount.Dec()&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;		if connections != 0 {&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;			log.Printf(&quot;connection_pool_event type=%s address=%s reason=%s connections=%d&quot;,&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;				poolEvent.Type, poolEvent.Address, poolEvent.Reason, connections)&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;		}&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;We&apos;re using the topology interface directly as follows:&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;		topology.WithServerOptions(func(opts ...topology.ServerOption) []topology.ServerOption {&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;			return append(opts, topology.WithConnectionPoolMonitor(getPoolMonitor))&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;Specifically, this falls over in the face of idle connections:&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;[2020-05-05 23:10:47.816442] 2020/05/05 23:10:47 connection_pool_event type=ConnectionCreated address=127.0.0.1:27017 reason= connections=18446744073709551612&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;[2020-05-05 23:10:47.816357] 2020/05/05 23:10:47 connection_pool_event type=ConnectionClosed address=127.0.0.1:27017 reason=idle connections=18446744073709551611&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;[2020-05-05 23:10:18.327002] 2020/05/05 23:10:18 connection_pool_event type=ConnectionClosed address=127.0.0.1:27017 reason=idle connections=18446744073709551612&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;[2020-05-05 23:10:18.326969] 2020/05/05 23:10:18 connection_pool_event type=ConnectionClosed address=127.0.0.1:27017 reason=idle connections=18446744073709551613&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;[2020-05-05 23:10:18.326940] 2020/05/05 23:10:18 connection_pool_event type=ConnectionClosed address=127.0.0.1:27017 reason=idle connections=18446744073709551614&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;[2020-05-05 23:10:18.326889] 2020/05/05 23:10:18 connection_pool_event type=ConnectionClosed address=127.0.0.1:27017 reason=idle connections=18446744073709551615&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;[2020-05-05 23:08:15.735278] 2020/05/05 23:08:15 connection_pool_event type=ConnectionCreated address=127.0.0.1:27017 reason= connections=1&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;The code for managing this counter is further complicated by the fact that multiple threads could be emitting these events in parallel, necessitating the need for an atomic counter. The len() value that the library has access to in its pointer receivers would be able to provide more accurate information without the need for an additional atomic operation.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="3062984" author="divjot.arora" created="Thu, 30 Apr 2020 17:34:17 +0000"  >&lt;p&gt;Ok, I&apos;d like to summarize everything I&apos;ve gathered from the comments to make sure we&apos;re on the same page. For simplicity, all of these comments assume that there&apos;s a single &lt;tt&gt;mongod&lt;/tt&gt; server running as a standalone.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;You might have multiple instances of the driver running connected to the same replica set. I assume this means multiple &lt;tt&gt;mongo.Client&lt;/tt&gt; instances. Each of those Client instances will create a connection pool.&lt;/li&gt;
	&lt;li&gt;You&apos;re using the same &lt;tt&gt;event.PoolMonitor&lt;/tt&gt; instance across Clients, so the monitoring callback will be called if either Client creates/closes a connection. I&apos;m not sure about this assumption, so please let me know if this is not correct.&lt;/li&gt;
	&lt;li&gt;The use case is to track the number of connections open in the pool when new connections are created. If this number is too high, you can detect that the Client responsible for that event has created too many connections and act upon that.&lt;/li&gt;
&lt;/ol&gt;
</comment>
                            <comment id="3062965" author="ajo@stripe.com" created="Thu, 30 Apr 2020 17:26:28 +0000"  >&lt;p&gt;Even that map won&apos;t help, because we may have different copies of the driver talking to the same node, which will each have their own connection pool. That&apos;s why I wanted to get the information from the source of truth rather than trying to reconstruct it out-of-band.&lt;/p&gt;</comment>
                            <comment id="3062953" author="divjot.arora" created="Thu, 30 Apr 2020 17:20:08 +0000"  >&lt;p&gt;It seems like the ConnnectionID field is a per-pool incrementing integer that gets assigned to a connection in &lt;tt&gt;pool.makeNewConnection&lt;/tt&gt;. However, this probably won&apos;t help for your use case because it doesn&apos;t seem like connection IDs are re-used after a connection is closed, likely for performance reasons. I&apos;ll talk over a solution with the rest of the team and post here once we have some more ideas. From what I can tell, it doesn&apos;t seem like there&apos;s an easy way to get the number of connections per-node, except for keeping a map from server address to connection count in the pool monitor.&lt;/p&gt;

&lt;p&gt;&amp;#8211; Divjot&lt;/p&gt;</comment>
                            <comment id="3062915" author="ajo@stripe.com" created="Thu, 30 Apr 2020 17:04:46 +0000"  >&lt;p&gt;This should be marked as an improvement, not a bug.&lt;/p&gt;



&lt;p&gt;We are interested in the number of connections per node, which will allow us to find clients that are creating too many connections. Since there&apos;s a semaphore per-node, I didn&apos;t want to introduce any further contention by attempting to figure out how many connections the other nodes have. It&apos;s possible to figure out the number of the connections in the driver overall after the fact by looking through logs and performing analysis, or by aggregating data in a data structure provided to the pool event monitor.&lt;/p&gt;

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

&lt;p&gt;Our use case involves many replsets, so a solution around keeping a counter would require us to pass state to the monitor function as a captured variable, and is much more complex to maintain that a quick call to len() while the lock is already held.&lt;/p&gt;

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

&lt;p&gt;I agree that it could be confusing to users not familiar with the internal workings of the driver. Do you think a different field name would be clearer? The driver already reports the per-backend connection ID, which I haven&apos;t been able to find a use case for in our client.&lt;/p&gt;</comment>
                            <comment id="3062539" author="divjot.arora" created="Thu, 30 Apr 2020 14:31:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ajo%40stripe.com&quot; class=&quot;user-hover&quot; rel=&quot;ajo@stripe.com&quot;&gt;ajo@stripe.com&lt;/a&gt; Do you have a specific reason for filing this as a bug? Adding this information would require adding a new field to the &lt;tt&gt;PoolEvent&lt;/tt&gt; struct, which seems more like an improvement than a bug.&lt;/p&gt;

&lt;p&gt;I looked over the PR you sent for this, and I&apos;m not sure it&apos;s correct because it reports the size of the pool that emits the event. However, there is one connection pool per node in the cluster (i.e. one per &lt;tt&gt;topology.Server&lt;/tt&gt; instance), so that&apos;s not going to accurately report the number of connections in the driver. That number will also change depending on which pool is emitting the event, as they all share the same monitor.&lt;/p&gt;

&lt;p&gt;As a workaround for the time being, you can keep a counter which gets incremented on &lt;tt&gt;ConnectionOpened&lt;/tt&gt; events and decremented on &lt;tt&gt;ConnectionClosed&lt;/tt&gt; events to track how many connections have been opened by the pool.&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|hx5t0v:</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>