<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:37: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-2050] Be able to supply http.Transport for OCSP</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2050</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Right now, http.DefaultClient is used which can leave lingering goroutines until &lt;tt&gt;CloseIdleConnections&lt;/tt&gt; is called. This is not desirable in multi-tenant applications or daemonized applications managed by the same go process. Preferably, a &lt;tt&gt;ClientContext&lt;/tt&gt; like method that supplies an&#160;&lt;tt&gt;http.Client&lt;/tt&gt; or &lt;tt&gt;http.Transport&lt;/tt&gt; could be created for this purpose; a new option would also work as well, but may be a little bloaty.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1783843">GODRIVER-2050</key>
            <summary>Be able to supply http.Transport for OCSP</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="matt.dale@mongodb.com">Matt Dale</assignee>
                                    <reporter username="eric@erdaniels.com">Eric Daniels</reporter>
                        <labels>
                    </labels>
                <created>Tue, 15 Jun 2021 20:38:16 +0000</created>
                <updated>Sat, 28 Oct 2023 11:37:46 +0000</updated>
                            <resolved>Mon, 31 Oct 2022 22:01:45 +0000</resolved>
                                                    <fixVersion>1.11.0</fixVersion>
                                    <component>Networking</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4942300" author="xgen-internal-githook" created="Mon, 31 Oct 2022 21:59:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Eric Daniels&apos;, &apos;email&apos;: &apos;eric@erdaniels.com&apos;, &apos;username&apos;: &apos;edaniels&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2050&quot; title=&quot;Be able to supply http.Transport for OCSP&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2050&quot;&gt;&lt;del&gt;GODRIVER-2050&lt;/del&gt;&lt;/a&gt; - Add settable http.Clients and gracefully close provided defaults (#1093)&lt;/p&gt;

&lt;p&gt;Co-authored-by: Benjamin Rewis &amp;lt;32186188+benjirewis@users.noreply.github.com&amp;gt;&lt;br/&gt;
Co-authored-by: Matt Dale &amp;lt;9760375+matthewdale@users.noreply.github.com&amp;gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/4a22ce6d689a699f0ba2f59cda7bc9a6a707935c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/4a22ce6d689a699f0ba2f59cda7bc9a6a707935c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4907414" author="benji.rewis" created="Mon, 17 Oct 2022 15:53:59 +0000"  >&lt;p&gt;Thanks so much &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=eric%40erdaniels.com&quot; class=&quot;user-hover&quot; rel=&quot;eric@erdaniels.com&quot;&gt;eric@erdaniels.com&lt;/a&gt;&#160;! Taking a look now (just authorized the evergreen patch).&lt;/p&gt;</comment>
                            <comment id="4907224" author="eric@erdaniels.com" created="Mon, 17 Oct 2022 15:19:04 +0000"  >&lt;p&gt;np! Just put up a PR. It was fairly trivial to add and made easier with options.&lt;/p&gt;</comment>
                            <comment id="4903945" author="benji.rewis" created="Fri, 14 Oct 2022 15:57:42 +0000"  >&lt;p&gt;Sounds great &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;&#160;thanks, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=eric%40erdaniels.com&quot; class=&quot;user-hover&quot; rel=&quot;eric@erdaniels.com&quot;&gt;eric@erdaniels.com&lt;/a&gt;&#160;!&#160;&lt;/p&gt;</comment>
                            <comment id="4903939" author="eric@erdaniels.com" created="Fri, 14 Oct 2022 15:54:25 +0000"  >&lt;p&gt;Right, that&apos;s why having both as options would be ideal. Worst case I can maintain a fork.&lt;/p&gt;</comment>
                            <comment id="4903925" author="benji.rewis" created="Fri, 14 Oct 2022 15:51:05 +0000"  >&lt;blockquote&gt;&lt;p&gt;I&apos;d also like to experiment with passing an option for the same http.Client since it&apos;s fairly common to provide a more customized client than the default provided by the standard library.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That sounds correct to me, but I think the bulk of users will not think to provide a custom &lt;tt&gt;http.Client&lt;/tt&gt; and call &lt;tt&gt;CloseIdleConnections&lt;/tt&gt; on it. It would probably be more seamless to call &lt;tt&gt;CloseIdleConnections&lt;/tt&gt; from &lt;tt&gt;http.Client&lt;/tt&gt; and warning &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/warning.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; that we may be slightly more hesitant to accept a PR that adds a custom &lt;tt&gt;http.Client&lt;/tt&gt; option for that reason.&lt;/p&gt;</comment>
                            <comment id="4903818" author="eric@erdaniels.com" created="Fri, 14 Oct 2022 15:24:57 +0000"  >&lt;p&gt;Yeah that sounds good. I&apos;d also like to experiment with passing an option for the same http.Client since it&apos;s fairly common to provide a more customized client than the default provided by the standard library. I&apos;ll try to take a pass pretty soon.&lt;/p&gt;</comment>
                            <comment id="4903560" author="benji.rewis" created="Fri, 14 Oct 2022 14:27:42 +0000"  >&lt;p&gt;Hello again, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=eric%40erdaniels.com&quot; class=&quot;user-hover&quot; rel=&quot;eric@erdaniels.com&quot;&gt;eric@erdaniels.com&lt;/a&gt;. The team probably won&apos;t have time to do this ourselves in the near future, so you&apos;re totally welcome to submit a PR.&lt;/p&gt;

&lt;p&gt;Rereading this: sounds like what you want is to bound the lifetime of resources created by creating and using a &lt;tt&gt;mongo.Client&lt;/tt&gt; to the lifetime of the &lt;tt&gt;mongo.Client&lt;/tt&gt;, which is definitely reasonable. That also seems like a improvement for all users, so we&apos;re thinking a better change might be to create an &lt;tt&gt;http.Client&lt;/tt&gt; with a &lt;tt&gt;mongo.Client&lt;/tt&gt;, use it for all OCSP queries, and call &lt;tt&gt;CloseIdleConnections&lt;/tt&gt; on it in &lt;tt&gt;monog.Client.Disconnect&lt;/tt&gt;. What do you think?&lt;/p&gt;</comment>
                            <comment id="4902194" author="eric@erdaniels.com" created="Thu, 13 Oct 2022 20:42:23 +0000"  >&lt;p&gt;So it&apos;s been about a year. Should I submit a PR instead?&lt;/p&gt;</comment>
                            <comment id="4155135" author="JIRAUSER1263092" created="Thu, 28 Oct 2021 17:24:23 +0000"  >&lt;p&gt;That works for me.&lt;/p&gt;</comment>
                            <comment id="4154796" author="benji.rewis" created="Thu, 28 Oct 2021 15:46:24 +0000"  >&lt;p&gt;Ah very interesting. Having complete control over the client (i.e. allowing a custom &lt;tt&gt;http.Client&lt;/tt&gt; or &lt;tt&gt;http.Transport&lt;/tt&gt; in &lt;tt&gt;VerifyOptions&lt;/tt&gt;)&#160;used to contact OCSP responders makes sense to me and doesn&apos;t seem like a big change. That&apos;s certainly an option here. It sounds like it&apos;d be even cleaner if something like &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/mongo/client.go#L203&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;mongo.Client.Disconnect&lt;/tt&gt;&lt;/a&gt; &lt;em&gt;also&lt;/em&gt; called &lt;tt&gt;CloseIdleConnections&lt;/tt&gt; on that &lt;tt&gt;http.Client&lt;/tt&gt;. That way, closing the Mongo client would also shut down those idle OCSP connections. That change seems slightly more complex (would have to store the OCSP &lt;tt&gt;http.Client&lt;/tt&gt; on &lt;tt&gt;mongo.Client&lt;/tt&gt;)&#160;but still feasible&#160;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/lightbulb_on.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;In any case, if this is not super high priority for you (do you have a workaround?), I&apos;ll remove the fix version on this ticket and leave it in &quot;Open&quot; for now.&lt;/p&gt;</comment>
                            <comment id="4153375" author="eric@erdaniels.com" created="Thu, 28 Oct 2021 00:29:13 +0000"  >&lt;p&gt;Hey Benji! No worries &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;. They are idle goroutines and in a system where thousands can be created for whatever reason, it&apos;s nice to have complete control/knowledge about what&apos;s out there and that they are all closed down. Calling&#160;&lt;tt&gt;CloseIdleConnections&lt;/tt&gt; is definitely a choice but feels a little clunky to me to have to combine it with closing down the mongo client which I would expect would clean up completely after itself, something it has historically strived to do while I had some involvement on the driver.&lt;/p&gt;

&lt;p&gt;This is truly not high priority so don&apos;t worry about getting back to this quickly!&lt;/p&gt;</comment>
                            <comment id="4149687" author="benji.rewis" created="Tue, 26 Oct 2021 20:22:05 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=eric%40erdaniels.com&quot; class=&quot;user-hover&quot; rel=&quot;eric@erdaniels.com&quot;&gt;eric@erdaniels.com&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Apologies for the crazy delay in response; we&#8217;ve had some higher priority work and just got around to this ticket &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;I assume you&#8217;re referring to the &lt;tt&gt;DefaultClient&lt;/tt&gt; used &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/ocsp/ocsp.go#L265&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; when contacting the responders for OCSP verification. I&#8217;m curious which goroutines are &#8220;lingering&#8221; for you. Are they idle goroutines? Or, are they active requests that haven&#8217;t yet made it to the OCSP responders?&lt;/p&gt;

&lt;p&gt;If it&#8217;s idle connections: &lt;br/&gt;
&lt;tt&gt;DefaultClient&lt;/tt&gt; uses &lt;a href=&quot;https://pkg.go.dev/net/http#RoundTripper&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;DefaultTransport&lt;/tt&gt;&lt;/a&gt; as its &lt;tt&gt;RoundTripper&lt;/tt&gt;, which means that the &lt;tt&gt;IdleConnTimeout&lt;/tt&gt; will be 90 seconds. If you&#8217;re finding that the 90 seconds isn&#8217;t a long enough idle timeout, we could allow specifying a custom &lt;tt&gt;http.Client&lt;/tt&gt; or &lt;tt&gt;http.Transport&lt;/tt&gt; (as you suggested) so you could either set a lower &lt;tt&gt;IdleConnTimeout&lt;/tt&gt; or manually call &lt;tt&gt;CloseIdleConnections&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;If it&#8217;s active requests:&lt;br/&gt;
&lt;tt&gt;DefaultClient&lt;/tt&gt; has no regular &lt;a href=&quot;https://cs.opensource.google/go/go/+/refs/tags/go1.17.2:src/net/http/client.go;l=106&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;Timeout&lt;/tt&gt;&lt;/a&gt;, which means that any request made through &lt;tt&gt;DefaultClient&lt;/tt&gt; will never timeout while active. &lt;tt&gt;CloseIdleConnections&lt;/tt&gt; would not be able to close goroutines with non-idle connections, so we&#8217;d need to set a &lt;tt&gt;Timeout&lt;/tt&gt; on the &lt;tt&gt;http.Client&lt;/tt&gt; used. We could do that pretty easily by changing &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/ocsp/ocsp.go#L265&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this line&lt;/a&gt; to:&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;client := &amp;amp;http.Client{Timeout: 30 * time.Second}&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;httpResponse, err := client.Do(request)&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;To enforce an active timeout of 30 seconds.&lt;/p&gt;

&lt;p&gt;Let me know what sounds better/what might solve the issue you&#8217;re seeing.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="2169093">GODRIVER-2623</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|hz9oh3:</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>