<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:56:38 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-2217] MongoCursor - maxTime - TimeoutException is thrown after wrong period of time</title>
                <link>https://jira.mongodb.org/browse/JAVA-2217</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Please have a look at following code snipped:&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;MongoDatabase db = mongoClient.getDatabase(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;local&quot;&lt;/span&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;);&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;   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;MongoCollection&amp;lt;Document&amp;gt; oplogCollection = db.getCollection(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;oplog.$main&quot;&lt;/span&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;);&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&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;   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;MongoCursor&amp;lt;Document&amp;gt; cursor = oplogCollection.find(aFilter())&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;   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;                .cursorType(CursorType.Tailable)&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;   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;                &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;//will throw MongoExecutionTimeoutException after ~ 10s -30s&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;   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;                .maxTime(&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;300&lt;/span&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;, MILLISECONDS)&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;   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;                .iterator();&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&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;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;//following code will produce an exception after like 10-30s:&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;cursor.hasNext(); &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;I tried to implement this functionality using cursor type=TailableAwait and maxAwaitTile(300, MILLISECONDS) but in such case code was just freezing without any timeout.&lt;/p&gt;</description>
                <environment></environment>
        <key id="292970">JAVA-2217</key>
            <summary>MongoCursor - maxTime - TimeoutException is thrown after wrong period of time</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="9">Done</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="krzysztofbarczyk">Krzysztof Barczyk</reporter>
                        <labels>
                    </labels>
                <created>Fri, 10 Jun 2016 13:57:44 +0000</created>
                <updated>Mon, 27 Feb 2017 13:37:17 +0000</updated>
                            <resolved>Fri, 23 Sep 2016 11:33:36 +0000</resolved>
                                    <version>3.2.2</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1510113" author="mganapat" created="Mon, 27 Feb 2017 13:37:17 +0000"  >&lt;p&gt;Thanks a lot Ross. I have posted it in stackoverflow too. It would be great if you could spend few minutes and answer that.&lt;br/&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/42471841/mongo-oplog-tailable-cursor&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/questions/42471841/mongo-oplog-tailable-cursor&lt;/a&gt;&lt;br/&gt;
I will post it in mongodb user mailing list too.&lt;/p&gt;

&lt;p&gt;Thanks in advance.,&lt;br/&gt;
Mouthgalya Ganapathy&lt;/p&gt;</comment>
                            <comment id="1510041" author="ross@10gen.com" created="Mon, 27 Feb 2017 10:36:53 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mganapat&quot; class=&quot;user-hover&quot; rel=&quot;mganapat&quot;&gt;mganapat&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;This is an old ticket that has been closed.  Please ask your questions on the &lt;a href=&quot;https://groups.google.com/forum/#!forum/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb-user mailinglist&lt;/a&gt; or on &lt;a href=&quot;http://stackoverflow.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stackoverflow&lt;/a&gt; and we&apos;ll endeavour to follow up there.&lt;/p&gt;

&lt;p&gt;All the best,&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="1509752" author="mganapat" created="Sun, 26 Feb 2017 19:28:52 +0000"  >&lt;p&gt;As a follow up clarification for the same exception below&lt;br/&gt;
com.mongodb.MongoExecutionTimeoutException: operation exceeded time limit&lt;/p&gt;

&lt;p&gt;a.) Would setting the maxTime help in handling the exception better?? What would be a practical value for maxTime given that we are using a tailable await cursor? The below link is indicating that for a cursor subsequent &quot;getmore&quot; requests will be included in the total time. &lt;a href=&quot;https://www.mongodb.com/blog/post/maxtimems-and-query-optimizer-introspection-in&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://www.mongodb.com/blog/post/maxtimems-and-query-optimizer-introspection-in&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;b.) How would using a non blocking cursor call help for tailable await cursor?? Would it help in bypassing the waiting? &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/MongoCursor.html#tryNext--&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/MongoCursor.html#tryNext--&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;c.) In case of an exception like above, what is the best way to handle the error gracefully and continue the processing of subsequent records?&lt;/p&gt;</comment>
                            <comment id="1391759" author="ross@10gen.com" created="Fri, 23 Sep 2016 11:33:36 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=krzysztofbarczyk&quot; class=&quot;user-hover&quot; rel=&quot;krzysztofbarczyk&quot;&gt;krzysztofbarczyk&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Many apologies for taking so long to look into this issue in detail.&lt;/p&gt;

&lt;p&gt;The &lt;tt&gt;maxTime&lt;/tt&gt; setting specifies a cumulative time limit for processing operations on a cursor.   As noted in the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS/#cursor.maxTimeMS&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;cursor.maxTimeMS documentation&lt;/a&gt; neither cursor idle time or network latency contribute towards its processing time.  &lt;/p&gt;

&lt;p&gt;This accounts for the observation of seeing the cursor take longer to throw a &lt;tt&gt;MongoExecutionTimeoutException&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;TailableAwait cursors are also a special case as each &lt;tt&gt;getMore&lt;/tt&gt; call to the server will set a maxTime, thus increasing the amount of observable time for an operation to complete.  By design it will await in a busy loop for more data.  &lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/MongoCursor.html#tryNext--&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;MongoCursor#tryNext&lt;/tt&gt;&lt;/a&gt; method is especially useful for tailable cursors as it will immediately return with either a document or a null.&lt;/p&gt;

&lt;p&gt;Because of how the server has implemented maxTime, I&apos;m marking this ticket as works as designed for the reasons mentioned above.&lt;/p&gt;</comment>
                            <comment id="1329747" author="krzysztofbarczyk" created="Wed, 20 Jul 2016 13:48:59 +0000"  >&lt;p&gt;Hi, thanks for your response.&lt;/p&gt;

&lt;p&gt;version of Java driver is: 3.2.2,&lt;br/&gt;
version of MongoDB is 3.2.0&lt;/p&gt;</comment>
                            <comment id="1316508" author="ross@10gen.com" created="Thu, 7 Jul 2016 10:42:29 +0000"  >&lt;p&gt;Apologies for the delay &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=krzysztofbarczyk&quot; class=&quot;user-hover&quot; rel=&quot;krzysztofbarczyk&quot;&gt;krzysztofbarczyk&lt;/a&gt;, could you confirm the version of MongoDB you are running this code against?&lt;/p&gt;</comment>
                            <comment id="1316477" author="krzysztofbarczyk" created="Thu, 7 Jul 2016 09:42:32 +0000"  >&lt;p&gt;Hi, is there any news? Were you able to reproduce the issue?&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|hspm93:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1302">JVM Sprint 36</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>