<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:19:32 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>[CDRIVER-3965] Version 1.17.5 adds a 4 seconds delay on each query</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3965</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Since I switch to version the MongoDB C driver 1.17.5 (I was using 1.9) all use of this driver, that used to run in a  few milliseconds, now takes more than 4 seconds to achieve.&lt;/p&gt;</description>
                <environment>Windows 10 64 bits</environment>
        <key id="1691268">CDRIVER-3965</key>
            <summary>Version 1.17.5 adds a 4 seconds delay on each query</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="13202">Works as Designed</resolution>
                                        <assignee username="kevin.albertson@mongodb.com">Kevin Albertson</assignee>
                                    <reporter username="bertrandop@free.fr">Olivier Bertrand</reporter>
                        <labels>
                    </labels>
                <created>Mon, 26 Apr 2021 09:31:41 +0000</created>
                <updated>Fri, 27 Oct 2023 13:14:08 +0000</updated>
                            <resolved>Fri, 7 May 2021 20:46:46 +0000</resolved>
                                    <version>1.17.5</version>
                                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3762006" author="kevin.albertson" created="Fri, 7 May 2021 20:46:46 +0000"  >&lt;p&gt;Great, I am glad to hear &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bertrandop%40free.fr&quot; class=&quot;user-hover&quot; rel=&quot;bertrandop@free.fr&quot;&gt;bertrandop@free.fr&lt;/a&gt;!&lt;/p&gt;</comment>
                            <comment id="3760520" author="JIRAUSER1259762" created="Fri, 7 May 2021 10:39:12 +0000"  >&lt;p&gt;Yes, I did it and there is no more delay, thanks.&lt;/p&gt;</comment>
                            <comment id="3760171" author="kevin.albertson" created="Fri, 7 May 2021 02:39:55 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bertrandop%40free.fr&quot; class=&quot;user-hover&quot; rel=&quot;bertrandop@free.fr&quot;&gt;bertrandop@free.fr&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for the additional information.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;BTW, adding the option &quot;tlsDisableOCSPEndpointCheck=true&quot; to the URI make all the queries fail:&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;My apologies, I intended to ask for &quot;tlsDisableCertificateRevocationCheck=true&quot;. If it is easy to check, trying with this option will help rule out whether OCSP is involved in the additional delay. Though given that you are observing a .5 second delay now, I suspect OCSP is unrelated. For reference, the URI options related to TLS and OCSP are documented in &lt;a href=&quot;http://mongoc.org/libmongoc/current/configuring_tls.html#configuring-tls&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Configuring TLS&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Starting the server by &quot;mongod --ipv6&quot; does not remove the delay but reduces it from 4.50 sec to 0.50 sec. So it seems that there are 2 delays, a 4 sec one for ipv6 and a 0.50 sec one for another cause.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That is good to know. I agree the 4 second delay seems caused by &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3639&quot; title=&quot;Connection failure may take 1-2s when connecting to the wrong address on Windows&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3639&quot;&gt;CDRIVER-3639&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have another hypothesis for the observed .5 second delay. Is your application creating and destroying a client pool (&lt;tt&gt;mongoc_client_pool_t&lt;/tt&gt;) on each request that is handling a translation from SQL? Based on the snippet that you provided, that may be the case.&lt;/p&gt;

&lt;p&gt;If so, this may be related to changes in multi-threaded monitoring (&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3535&quot; title=&quot;Reduce Client Time To Recovery On Topology Changes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3535&quot;&gt;&lt;del&gt;CDRIVER-3535&lt;/del&gt;&lt;/a&gt;). A call to &lt;tt&gt;mongoc_client_pool_destroy&lt;/tt&gt; may experience a delay of 500ms when connected to one or more 4.4+ MongoDB servers during the shutdown process of long polling.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://mongoc.org/libmongoc/current/connection-pooling.html#pooled-mode&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Connection Pooling&lt;/a&gt; has additional details describing the behavior differences of pooled and single-threaded modes. But typical use of a &lt;tt&gt;mongoc_client_pool_t&lt;/tt&gt; is to keep the pool alive for the duration of a long lived process. The discovered state of MongoDB servers can be reused on each pooled client and monitoring can continue in background threads without blocking operations.&lt;/p&gt;

&lt;p&gt;However, if your application is handling short lived requests and creating and destroying a &lt;tt&gt;mongoc_client_pool_t&lt;/tt&gt; on each request, it may be preferable to use a single-threaded &lt;tt&gt;mongoc_client_t&lt;/tt&gt;. That would result in less resources used (no background monitoring threads) and may avoid the .5 second delay on shutdown.&lt;/p&gt;

&lt;p&gt;The .5 second delay in pooled monitoring has been an issue for drivers wrapping the C driver testing: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3801&quot; title=&quot;mongoc_client_pool_destroy performance degradation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3801&quot;&gt;&lt;del&gt;CDRIVER-3801&lt;/del&gt;&lt;/a&gt;, but if this is the cause, and your application requires creating and destroying a client pool on each request, we can investigate improving this behavior.&lt;/p&gt;

&lt;p&gt;As a workaround, would it be possible to try replacing the &lt;tt&gt;mongoc_client_pool_t&lt;/tt&gt; with a single-threaded &lt;tt&gt;mongoc_client_t&lt;/tt&gt;?&lt;/p&gt;</comment>
                            <comment id="3746086" author="JIRAUSER1259762" created="Thu, 29 Apr 2021 10:25:29 +0000"  >&lt;p&gt;Starting the server by &quot;mongod --ipv6&quot; does not remove the delay but reduces it from 4.50 sec to 0.50 sec. So it seems that there are 2 delays, a 4 sec one for ipv6 and a 0.50 sec one for another cause. Of course, none of them for older C drivers (last used 1.9.2)&lt;/p&gt;

&lt;p&gt;BTW, adding the option &quot;tlsDisableOCSPEndpointCheck=true&quot; to the URI make all the queries fail:&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; 2021/04/29 12:49:59.0939: [16032]: ERROR: stream-tls-secure-channel: Setting tlsDisableOCSPEndpointCheck has no effect when built against Secure Channel&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; 2021/04/29 12:49:59.0965: [16032]: ERROR: stream-secure-channel: failed to receive handshake, SSL/TLS connection failed&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; 2021/04/29 12:49:59.0965: [16032]: DEBUG: monitor: [localhost:27017] command or network error occurred: TLS handshake failed&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;</comment>
                            <comment id="3746063" author="JIRAUSER1259762" created="Thu, 29 Apr 2021 10:09:57 +0000"  >&lt;p&gt;I am doing my testing using a local MongoDB server started by executing &quot;mongod&quot; with no parameters. The URI used by my program is simply &quot;mongodb://localhost:27017&quot;.&lt;/p&gt;

&lt;p&gt;It was Ok with older releases of the C driver. Could you elaborate and show what I should try?&lt;/p&gt;</comment>
                            <comment id="3745512" author="JIRAUSER1259762" created="Wed, 28 Apr 2021 22:48:53 +0000"  >&lt;p&gt;Indeed, only the first one has a delay. Subsequent operations have no delay.&lt;/p&gt;</comment>
                            <comment id="3744134" author="kevin.albertson" created="Wed, 28 Apr 2021 15:34:26 +0000"  >&lt;p&gt;Thank you for the additional information&#160;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bertrandop%40free.fr&quot; class=&quot;user-hover&quot; rel=&quot;bertrandop@free.fr&quot;&gt;bertrandop@free.fr&lt;/a&gt;. I have two theories:&lt;/p&gt;

&lt;p&gt;1. This could be related to failed connection attempts on hostnames resolving to multiple IPs. &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3639&quot; title=&quot;Connection failure may take 1-2s when connecting to the wrong address on Windows&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3639&quot;&gt;CDRIVER-3639&lt;/a&gt; describes a 1-2 second delay observed on Windows when the hostname resolved to both an IPv6 and IPv4 address, but the server was only listening on IPv4. To determine if that is the cause, can you try specifying an IP literal in the URI to connect to and see if that resolves the delay?&lt;/p&gt;

&lt;p&gt;2. This could be related to failed OCSP validation of server certificates if the client is taking a long time to reach an OCSP server. &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3788&quot; title=&quot;DNS Lookup Failures to OCSP Exhausts connectTimeoutMS&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3788&quot;&gt;CDRIVER-3788&lt;/a&gt; describes timeouts causing delays on each first connection. Can you try including &lt;tt&gt;tlsDisableOCSPEndpointCheck=true&lt;/tt&gt; to bypass OCSP checks to see if that resolves the delay?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;and the delay occurs on the first execution of mongoc_cursor_next.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;To check, do operations after the first one still have a delay? I would imagine if &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3639&quot; title=&quot;Connection failure may take 1-2s when connecting to the wrong address on Windows&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3639&quot;&gt;CDRIVER-3639&lt;/a&gt; or &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3788&quot; title=&quot;DNS Lookup Failures to OCSP Exhausts connectTimeoutMS&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3788&quot;&gt;CDRIVER-3788&lt;/a&gt; is the cause, subsequent operations after a connection is established would no longer have a delay. In practice, this would be the first operation on a server per &lt;tt&gt;mongoc_client_t&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="3740060" author="JIRAUSER1259762" created="Mon, 26 Apr 2021 22:22:09 +0000"  >&lt;p&gt;On another query where I do not execute the mongo collection count function, I continue by:&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;Cursor = mongoc_collection_find_with_opts(Collection, Query, NULL, NULL);&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: #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; (mongoc_cursor_next(Cursor, &amp;amp;Document))&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;and the delay occurs on the first execution of&#160;&#160;&lt;em&gt;mongoc_cursor_next&lt;/em&gt;.&lt;/p&gt;</comment>
                            <comment id="3740023" author="JIRAUSER1259762" created="Mon, 26 Apr 2021 21:57:14 +0000"  >&lt;p&gt;By the way, I had in the past installed versions 1.6.2, 1.6.3, 1.7.0 and 1.9.2 from tarball with no problem.&lt;/p&gt;

&lt;p&gt;But when downloading version 1.17.5, after extracting and trying to follow what it described in the site explaining how to install, all try to generate the visual studio with cmake failed. Unfortunately I didn&apos;t keep a log of all these.&lt;/p&gt;

&lt;p&gt;Finally, I cloned it from the git site and then the cmake process and compilation by Visual Studio 2019 succeeded. The 4 second delay I am describing occurs as well with the Debug, Release or Relwithdebinfo versions.&lt;/p&gt;</comment>
                            <comment id="3739998" author="JIRAUSER1259762" created="Mon, 26 Apr 2021 21:41:29 +0000"  >&lt;p&gt;I&apos;ll try to do that but in fact I&apos;m using this driver in a rather big application, the MariaDB Connect storage engine, in which I translate SQL queries in call to MongoDB through the C driver.&lt;br/&gt;
 When I say &quot;all use of the driver&quot; his means whether they are Select or CURL queries.&lt;/p&gt;

&lt;p&gt;For instance, reading the inventory collection, I execute in that order:&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;  mongo_init(true);&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;  Uri = mongoc_uri_new_with_error(Pcg-&amp;gt;Uristr, &amp;amp;Error);&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;  // Create a new client pool instance&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;  Pool = mongoc_client_pool_new(Uri);&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;  mongoc_client_pool_set_error_api(Pool, 2);&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;  // Register the application name so we can track it in the profile logs&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;  // on the server. This can also be done from the URI.&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;  mongoc_client_pool_set_appname(Pool, &quot;Connect&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;&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;  // Create a new client instance&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;  Client = mongoc_client_pool_pop(Pool);&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;  Collection = mongoc_client_get_collection(Client, Pcg-&amp;gt;Db_name, Pcg-&amp;gt;Coll_name);&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;  query = bson_new();&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;#if defined(NDEBUG)&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;  cnt = (int)mongoc_collection_count(Collection,&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;    MONGOC_QUERY_NONE, query, 0, 0, NULL, &amp;amp;Error);&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;#else&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 (jf)&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;    cnt = (int)mongoc_collection_count_documents(Collection,&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;      query, NULL, NULL, NULL, &amp;amp;Error);&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;  else&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;    cnt = (int)mongoc_collection_estimated_document_count(&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;           Collection, NULL, NULL, NULL, &amp;amp;Error);&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;#endif&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;.....&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 #if, #else, #endif are whether I use and old MongoDB version or the latest one)&lt;/p&gt;

&lt;p&gt;All is normal until I execute one of &lt;em&gt;mongoc_collection_count&lt;/em&gt; function that takes more to 4/5 seconds to execute with the latest C Driver version when it takes almost no time with the old version.&lt;/p&gt;

&lt;p&gt;If I don&apos;t execute it, this 4 second delay occurs later but does occur anyway.&lt;/p&gt;</comment>
                            <comment id="3738218" author="jmikola@gmail.com" created="Mon, 26 Apr 2021 12:24:10 +0000"  >&lt;p&gt;Can you clarify exactly what you mean by &quot;all use of this driver&quot;?&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;The first call to &lt;tt&gt;mongoc_init&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;Creating a client or client pool from a URI&lt;/li&gt;
	&lt;li&gt;The first operation that interacts with the database (e.g. executing a query), which would be the point when server discovery occurs&lt;/li&gt;
	&lt;li&gt;Each and every operation that interacts with the database&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Some additional questions:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Can you share your connection string (redacting sensitive info) and URI options?&lt;/li&gt;
	&lt;li&gt;What server version and topology (e.g. sharded cluster, replica set) are you connecting to?&lt;/li&gt;
	&lt;li&gt;Can you share a minimal application that reproduces the issue?&lt;/li&gt;
	&lt;li&gt;Can you share trace logs (see below) covering the delay?&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Capturing &lt;a href=&quot;http://mongoc.org/libmongoc/1.17.0/logging.html#tracing&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;trace logs&lt;/a&gt; for a small application that reproduces the delay would also be helpful, as that will provide timestamps for various internal functions and should narrow down where this 4-second delay occurs. Trace logs may include sensitive information (e.g. byte dumps of socket IO), so you should be sure to redact anything sensitive within before sharing.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1331461">CDRIVER-3639</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hyrisf:</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>