<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:12 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>[JAVA-3690] Domain name resolution issues break DefaultConnectionPool when using getAsync</title>
                <link>https://jira.mongodb.org/browse/JAVA-3690</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I&apos;ve recently experienced intermittent DNS resolution issues while working on a project and these issues eventually resulted all future queries failing with &quot;Timeout waiting for a pooled item ...&quot;. Restarting the program helped but the problem would resurface after enough resolution failures.&lt;/p&gt;

&lt;p&gt;Now this is technically a Scala application using the Scala driver but I was able to pinpoint the problem. Invoking &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;getAsync(SingleResultCallback&amp;lt;InternalConnection&amp;gt;)&lt;/tt&gt;&lt;/font&gt; on &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;DefaultConnectionPool&lt;/tt&gt;&lt;/font&gt; will invoke &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;openAsync&lt;/tt&gt;&lt;/font&gt; to open the pooled connection if it isn&apos;t already open. And when the connection is backed by a &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;AsynchronousSocketChannelStream&lt;/tt&gt;&lt;/font&gt; or &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;NettyStream&lt;/tt&gt;&lt;/font&gt; that invokes their &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;openAsync(AsyncCompletionHandler&amp;lt;Void&amp;gt;)&lt;/tt&gt;&lt;/font&gt; which executes &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;serverAddress.getSocketAddresses()&lt;/tt&gt;&lt;/font&gt;. It appears that &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;openAsync&lt;/tt&gt;&lt;/font&gt; in &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;DefaultConnectionPool&lt;/tt&gt;&lt;/font&gt; is only expecting exceptions via it&apos;s callback. But exception thrown form &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;serverAddress.getSocketAddresses()&lt;/tt&gt;&lt;/font&gt; are propagated all the way back to it.&lt;br/&gt;
Now at least in the Scala driver the exception is caught by an &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;ErrorHandlingResultCallback&lt;/tt&gt;&lt;/font&gt; eventually, which stops the exception. &lt;b&gt;But nothing releases the connection back to the pool.&lt;/b&gt; This eventually exhausts the pool and makes it unusable.&lt;/p&gt;

&lt;p&gt;After enabling trace logs I noticed that the connection that was being opened right before  &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;ErrorHandlingResultCallback&lt;/tt&gt;&lt;/font&gt; logged an error was always lost. Even after 3 hours it was never checked back into the pool or referenced in any other log message.&lt;/p&gt;

&lt;p&gt;I believe that the &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;openAsync&lt;/tt&gt;&lt;/font&gt; methods in &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;AsynchronousSocketChannelStream&lt;/tt&gt;&lt;/font&gt; and &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;NettyStream&lt;/tt&gt;&lt;/font&gt; should capture throwables and use them to fail the &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;AsyncCompletionHandler&lt;/tt&gt;&lt;/font&gt;. I&apos;m not sure if that could break any existing use cases. Though based on the history of these two files the execution of &lt;font color=&quot;#0747a6&quot;&gt;&lt;tt&gt;serverAddress.getSocketAddresses()&lt;/tt&gt;&lt;/font&gt; used to be inside a try block, but was moved out of when &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2700&quot; title=&quot;Implement fallback to IP v4/IP v6 vice-versa&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2700&quot;&gt;&lt;del&gt;JAVA-2700&lt;/del&gt;&lt;/a&gt; added support for connecting to all IPs and part of the method was made recursive.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1309727">JAVA-3690</key>
            <summary>Domain name resolution issues break DefaultConnectionPool when using getAsync</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="john.stewart@mongodb.com">John Stewart</assignee>
                                    <reporter username="metod@medja.net">Metod Medja</reporter>
                        <labels>
                    </labels>
                <created>Thu, 9 Apr 2020 15:53:57 +0000</created>
                <updated>Sat, 28 Oct 2023 11:21:43 +0000</updated>
                            <resolved>Thu, 30 Apr 2020 15:24:23 +0000</resolved>
                                    <version>3.9.0</version>
                    <version>4.0.0</version>
                                    <fixVersion>4.1.0</fixVersion>
                                    <component>Async</component>
                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4843786" author="JIRAUSER1269721" created="Wed, 21 Sep 2022 00:40:19 +0000"  >
&lt;p&gt;Thank you for the quick response Jeffrey.&lt;/p&gt;

&lt;p&gt;We hit a similar issue in production where all the threads are stuck and&lt;br/&gt;
getting the error &quot;Timeout waiting for a pooled item after&quot; continuously&lt;br/&gt;
until the application was restarted. Unfortunately, we could not collect&lt;br/&gt;
the stack trace / heap dump before the application was restarted.&lt;/p&gt;

&lt;p&gt;Do you have any suggestions on what kind of scenarios can hit this problem&lt;br/&gt;
? Or any other known defects in 3.7.2 release ?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
chowdary.&lt;/p&gt;
</comment>
                            <comment id="4842286" author="jeff.yemin" created="Tue, 20 Sep 2022 16:00:22 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=malempati77%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;malempati77@gmail.com&quot;&gt;malempati77@gmail.com&lt;/a&gt;, I don&apos;t think this particular issue is present in the 3.7 release.  The regression that this fixed was introduced in &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/c9913ca42ab0978029449955a56e05386d2caa91&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the commit&lt;/a&gt; for &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2700&quot; title=&quot;Implement fallback to IP v4/IP v6 vice-versa&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2700&quot;&gt;&lt;del&gt;JAVA-2700&lt;/del&gt;&lt;/a&gt;, which was first released in 3.9.0.  So if you&apos;re seeing something similar, it&apos;s likely a different issue.&lt;/p&gt;</comment>
                            <comment id="4840134" author="JIRAUSER1269721" created="Mon, 19 Sep 2022 22:53:31 +0000"  >&lt;p&gt;Is this issue applicable to 3.7.2 driver ? We are experiencing similar issue with MongoDB 3.6.9 and mongodb driver 3.7.2&lt;/p&gt;</comment>
                            <comment id="3062659" author="xgen-internal-githook" created="Thu, 30 Apr 2020 15:22:49 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;John Stewart&apos;, &apos;email&apos;: &apos;john.stewart@mongodb.com&apos;, &apos;username&apos;: &apos;jstewart-mongo&apos;}
&lt;p&gt;Message: Domain name resolution issues break DefaultConnectionPool when using getAsync&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3690&quot; title=&quot;Domain name resolution issues break DefaultConnectionPool when using getAsync&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3690&quot;&gt;&lt;del&gt;JAVA-3690&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/e52a27667fd51ff66935ff73f635f6022a01b6c0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/e52a27667fd51ff66935ff73f635f6022a01b6c0&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="1378523">JAVA-3761</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|hr6trb:</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>