<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:56:57 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-2337] Earlier detection when replica becomes unreachable</title>
                <link>https://jira.mongodb.org/browse/JAVA-2337</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;There are several possible ways to lost replica server from cluster:&lt;br/&gt;
 1. mongod process is crashed / killed / exited&lt;br/&gt;
 2. host becomes unreachable (turned off or some sort of network problems which leads to host unreachability).&lt;/p&gt;

&lt;p&gt;Async mongo-java-driver differently handles this situations. I don&apos;t know behaviour of the synchronous one because I&apos;m not using it. Maybe it has the same problems.&lt;/p&gt;

&lt;p&gt;What&apos;s happening from async driver perspective:&lt;/p&gt;

&lt;p&gt;In first case we will start receiving TCP segments with RST bit set, connection will be dropped and we will get MongoSocket(Read|Write)Exception while executing some operation. In DefaultServer class we &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/connection/DefaultServer.java#L182-L184&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;will invalidate&lt;/a&gt; connection pool and change server status to UNKNOWN. This helps to detect that replica is down earlier (usually before monitoring thread detects it) and avoid to use probably broken connections in subsequent operations.&lt;/p&gt;

&lt;p&gt;In second case we will get nothing in response. So the only way to detect this kind of problems to use socket timeouts. After configured amount of time we not receive anything from socket we will get MongoSocketReadTimeoutException. But DefaultServer class will not invalidate connection pool &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/connection/DefaultServer.java#L156&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;in such case&lt;/a&gt;. Server state is not changed and we will continue to use that server in subsequent operations. Because current connection is not released yet (we are waiting response from unreachable host) subsequent operations will unsuccessfully try to open new connections and get MongoSocketOpenException after configured socket connection timeout time. But this is &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/connection/DefaultServer.java#L99-L101&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;also ignored&lt;/a&gt; in DefaultServer class.&lt;/p&gt;

&lt;p&gt;All that we can do is to wait when monitoring thread wakes up after configured HeartbeatFrequency time, tries to read new server state, blocks, receives its socket read timeout and finally changes server state to UNKNOWN.&lt;br/&gt;
This is quite a lot of time.&lt;/p&gt;</description>
                <environment></environment>
        <key id="321776">JAVA-2337</key>
            <summary>Earlier detection when replica becomes unreachable</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="9">Done</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="jamel">Sergey Polovko</reporter>
                        <labels>
                    </labels>
                <created>Fri, 7 Oct 2016 01:27:47 +0000</created>
                <updated>Tue, 9 Jan 2018 14:22:07 +0000</updated>
                            <resolved>Tue, 9 Jan 2018 14:22:07 +0000</resolved>
                                    <version>3.0.0</version>
                                    <fixVersion>3.7.0</fixVersion>
                                    <component>Cluster Management</component>
                                        <votes>2</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1768859" author="xgen-internal-githook" created="Tue, 9 Jan 2018 14:20:05 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Jeff Yemin&apos;, &apos;username&apos;: &apos;jyemin&apos;, &apos;email&apos;: &apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2337&quot; title=&quot;Earlier detection when replica becomes unreachable&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2337&quot;&gt;&lt;del&gt;JAVA-2337&lt;/del&gt;&lt;/a&gt;: invalidate the server if opening a connection to it throws any MongoSocketException&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/fdae4206ee349b6e41599c613c5382046bda0a95&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/fdae4206ee349b6e41599c613c5382046bda0a95&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1653861" author="jeff.yemin" created="Tue, 22 Aug 2017 14:53:24 +0000"  >&lt;p&gt;The spec that describes this behavior has been updated to reflect this use case.  See &lt;a href=&quot;https://github.com/mongodb/specifications/commit/bfddbd98bf396104f78500f93f1f13e3fd2d8c3a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; for the relevant change.&lt;/p&gt;

&lt;p&gt;So we can proceed with this in the next release.  Happy to accept a pull request if you&apos;re so inclined.&lt;/p&gt;</comment>
                            <comment id="1510842" author="jamel" created="Mon, 27 Feb 2017 23:57:15 +0000"  >&lt;p&gt;Hi Jeff,&lt;/p&gt;

&lt;p&gt;Do you have any considerations about this use case? I would be happy to help and provide PR if you think this issue needs some.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Sergey&lt;/p&gt;</comment>
                            <comment id="1461009" author="jeff.yemin" created="Mon, 19 Dec 2016 14:31:12 +0000"  >&lt;p&gt;Hi Sergey,&lt;/p&gt;

&lt;p&gt;We are considering this use case and will get back to you when we&apos;ve decided how to handle it.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Jeff&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="468474">DRIVERS-429</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                                        </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|hrar2n:</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>