<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:56 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-290] mongo driver should check whether socket still be available before use it?</title>
                <link>https://jira.mongodb.org/browse/JAVA-290</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;After the driver open a socket to mongos,we shutdown mongos and restart it,then write two record into mongos,the first one will lost.&lt;/p&gt;

&lt;p&gt;We had set autoConnectRetry to true.&lt;/p&gt;

&lt;p&gt;The driver check if ( _socket == null ) only,should it check _socket can works fine also?&lt;/p&gt;

&lt;p&gt;There are some exceptions:&lt;/p&gt;

&lt;p&gt;Caused by: com.mongodb.MongoException$Network: can&apos;t say something&lt;br/&gt;
        at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:169) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:141) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:225) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:180) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
Caused by: java.net.SocketException: Broken pipe&lt;br/&gt;
        at java.net.SocketOutputStream.socketWrite0(Native Method) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;na:1.6.0_16&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;na:1.6.0_16&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;na:1.6.0_16&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at org.bson.io.PoolOutputBuffer.pipe(PoolOutputBuffer.java:113) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at com.mongodb.OutMessage.pipe(OutMessage.java:157) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at com.mongodb.DBPort.go(DBPort.java:92) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at com.mongodb.DBPort.go(DBPort.java:66) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at com.mongodb.DBPort.say(DBPort.java:61) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:155) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo-java-driver-2.4-jar.jar:na&amp;#93;&lt;/span&gt;&lt;/p&gt;</description>
                <environment>mongodb 1.8</environment>
        <key id="14974">JAVA-290</key>
            <summary>mongo driver should check whether socket still be available before use it?</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="phoenix">phoenix</reporter>
                        <labels>
                    </labels>
                <created>Thu, 3 Mar 2011 08:55:31 +0000</created>
                <updated>Wed, 19 Oct 2016 14:17:22 +0000</updated>
                            <resolved>Tue, 14 Jun 2011 03:39:16 +0000</resolved>
                                    <version>2.4</version>
                                                                        <votes>2</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="48892" author="antoine" created="Tue, 16 Aug 2011 18:48:50 +0000"  >&lt;p&gt;if you get the SocketTimeoutException it means that the server is not responding at all on that connection (not even RST).&lt;br/&gt;
So most likely it would be impossible to test the connection state.&lt;br/&gt;
Also doing retries after a timeout is dangerous as it can lock up the driver for a while.&lt;br/&gt;
Your code needs to properly catch those exceptions.&lt;br/&gt;
thx&lt;/p&gt;</comment>
                            <comment id="48740" author="dzignsnz" created="Tue, 16 Aug 2011 02:29:48 +0000"  >&lt;p&gt;I&apos;m seeing something similar in that the connection to the mongo server is closed (server log shows connection closed), but the java socket doesn&apos;t seem to realise it has been closed. Then attempting to do a find on a collection, results in &quot;java.net.SocketTimeoutException: Read timed out&quot;&lt;br/&gt;
Subsequent finds are fine, since a new connection is made after the SocketTimeoutException - until that new socket eventually closes again in a few hours. &lt;br/&gt;
I think this wouldn&apos;t be a problem if it were to retry since it would then have a new connection, but retries were specifically excluded for SocketTimeouts by &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-351&quot; title=&quot;do not retry reads if exception is SocketTimeoutException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-351&quot;&gt;&lt;del&gt;JAVA-351&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;mongo 1.8.1 + java driver 2.6.3&lt;/p&gt;</comment>
                            <comment id="37437" author="scotthernandez" created="Tue, 14 Jun 2011 03:38:39 +0000"  >&lt;p&gt;If the socket is in a bad state it will throw an exception and we will create a new one. I believe we are doing a better job at tossing all those server&apos;s sockets in this case and this improvement has been included in 2.6.x: see &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-335&quot; title=&quot;all connections to a server should get closed under certain types of exception&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-335&quot;&gt;&lt;del&gt;JAVA-335&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are always going to be errors on writes after a server has been restarted, or the connections have been lost. You can do a read first to flush the sockets for example. Doing this in the driver is no more efficient and isn&apos;t appropriate for writes.&lt;/p&gt;</comment>
                            <comment id="37200" author="pdwalker" created="Mon, 13 Jun 2011 07:20:21 +0000"  >&lt;p&gt;I&apos;m seeing this problem too often.  For some reason that I don&apos;t know why, the socket is getting closed with a &quot;java.net.SocketException: Connection reset&quot; error. (java driver 2.5.3 - server 1.8.1)&lt;/p&gt;
</comment>
                            <comment id="26552" author="louth" created="Wed, 23 Mar 2011 05:52:51 +0000"  >&lt;p&gt;I&apos;m interested in seeing a solution here because I need to handle cases where the mongo server has been restarted. &lt;/p&gt;

&lt;p&gt;In these cases, the server is available but saves will fail because the socket is no longer valid.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="16230">JAVA-335</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|hrhcf3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14812</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>