<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:55 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-721] Read Time out intermittently while reading</title>
                <link>https://jira.mongodb.org/browse/JAVA-721</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I have a simple web application running in Apache Tomcat that is attempting to read a document from mongo on some user action. While this generally works, it occasionally throws a Read timeout Exception (full stack trace at the end). &lt;/p&gt;

&lt;p&gt;I&apos;ve observed that this usually happens when there is no activity on the server for some time - but I unable to ascertain the duration of inactivity. I also know that this is not a connectivity issue - I wrote a small application that does a read every second. This app continues to run during the time when my web app complains about timeout. Another interesting observation is that this problem does not occur for clients on the same machine as mongo server. &lt;/p&gt;

&lt;p&gt;I&apos;ve done some reading &amp;amp; figured that reducing keep alive time interval might help but I&apos;m not sure on that. Is there a recommended setting for keep alive time interval?  &lt;/p&gt;

&lt;p&gt;My configuration parameters are as following&lt;/p&gt;

&lt;p&gt;mongoOptions.connectTimeout=5000&lt;br/&gt;
mongoOptions.socketTimeout=60000&lt;br/&gt;
mongoOptions.socketKeepAlive=true&lt;br/&gt;
mongoOptions.maxWaitTime=15000&lt;br/&gt;
mongoOptions.autoConnectRetry=true&lt;/p&gt;


&lt;p&gt;Additional Settings&lt;br/&gt;
I&apos;m using Java Driver 2.10.1 on a linux box (Ubuntu server 12.10) and connecting to mongo server 2.0.6 running on windows server 2008. I&apos;m using JDK 7&lt;/p&gt;

&lt;p&gt;Stack Trace&lt;br/&gt;
Caused by: java.net.SocketTimeoutException: Read timed out&lt;br/&gt;
	at java.net.SocketInputStream.socketRead0(Native Method)&lt;br/&gt;
	at java.net.SocketInputStream.read(SocketInputStream.java:150)&lt;br/&gt;
	at java.net.SocketInputStream.read(SocketInputStream.java:121)&lt;br/&gt;
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)&lt;br/&gt;
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)&lt;br/&gt;
	at java.io.BufferedInputStream.read(BufferedInputStream.java:334)&lt;br/&gt;
	at org.bson.io.Bits.readFully(Bits.java:46)&lt;br/&gt;
	at org.bson.io.Bits.readFully(Bits.java:33)&lt;br/&gt;
	at org.bson.io.Bits.readFully(Bits.java:28)&lt;br/&gt;
	at com.mongodb.Response.&amp;lt;init&amp;gt;(Response.java:40)&lt;br/&gt;
	at com.mongodb.DBPort.go(DBPort.java:124)&lt;br/&gt;
	at com.mongodb.DBPort.call(DBPort.java:74)&lt;br/&gt;
	at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:286)&lt;br/&gt;
	... 42 more&lt;/p&gt;</description>
                <environment>Ubuntu 12.10</environment>
        <key id="60536">JAVA-721</key>
            <summary>Read Time out intermittently while reading</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="-1">Unassigned</assignee>
                                    <reporter username="guneetsahai">Guneet Sahai</reporter>
                        <labels>
                            <label>connections</label>
                            <label>timeout</label>
                    </labels>
                <created>Fri, 28 Dec 2012 19:52:10 +0000</created>
                <updated>Sat, 5 Jan 2013 02:26:12 +0000</updated>
                            <resolved>Sat, 5 Jan 2013 02:26:12 +0000</resolved>
                                    <version>2.9.3</version>
                    <version>2.10.1</version>
                                                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="231469" author="guneetsahai" created="Sat, 5 Jan 2013 01:23:43 +0000"  >&lt;p&gt;The problem seems to have been solved for me. Here&apos;s the resolution: &lt;/p&gt;

&lt;p&gt;Additional Information - On one of the environments, I have monogo server running on version 2.2.x. This problem does not occur there with the same driver version. &lt;/p&gt;

&lt;p&gt;On my testing environment where the mongo server version is 2.0.3 - I tried reducing the keepalive time to 5 mins (as advised at &lt;a href=&quot;http://docs.mongodb.org/manual/faq/diagnostics/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/faq/diagnostics/&lt;/a&gt; from 2 hours) on the client machine (running on linux) &amp;amp; that helped. &lt;/p&gt;

&lt;p&gt;I haven&apos;t seen the problem re-occur for last couple of days. Can close the issue (I couldn&apos;t find a way to do this myself). &lt;/p&gt;</comment>
                    </comments>
                    <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|hrla1r:</customfieldvalue>

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