<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:09 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-383] cursor.count() is positive, but cursor.hasNext() returns false</title>
                <link>https://jira.mongodb.org/browse/JAVA-383</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>
&lt;p&gt;From the logs, it seems to indicate that we get count of 8. However, cursor.hasNext() is false.&lt;/p&gt;


&lt;p&gt;Bad&lt;br/&gt;
===&lt;br/&gt;
2011-06-16 23:50:15,156 INFO &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: start update on Jun 16, 2011 23:50:15 last updated Jun 15, 2011 23:48:43&lt;br/&gt;
2011-06-16 23:50:15,156 INFO &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: find 8 entries on Jun 16, 2011 23:50:15&lt;br/&gt;
2011-06-16 23:50:15,182 ERROR &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: bad query result for mortgage armindex20110616234917&lt;br/&gt;
2011-06-16 23:50:15,183 INFO &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: end update on Jun 16, 2011 23:50:15 size=8 table timestamp Jun 15, 2011 23:48:43&lt;/p&gt;


&lt;p&gt;Good&lt;br/&gt;
====&lt;br/&gt;
2011-06-17 00:05:15,156 INFO &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: start update on Jun 17, 2011 00:05:15 last updated Jun 15, 2011 23:48:43&lt;br/&gt;
2011-06-17 00:05:15,156 INFO &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: find 8 entries on Jun 17, 2011 00:05:15&lt;br/&gt;
2011-06-17 00:05:15,157 DEBUG &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: updates 1MOLIBOR   .190&lt;br/&gt;
2011-06-17 00:05:15,157 DEBUG &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: updates 2YRUST     .410&lt;br/&gt;
2011-06-17 00:05:15,157 DEBUG &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: updates 6MOLIBOR   .390&lt;br/&gt;
2011-06-17 00:05:15,157 DEBUG &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: updates COFI       1.359&lt;br/&gt;
2011-06-17 00:05:15,157 DEBUG &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: updates LIBOR      .720&lt;br/&gt;
2011-06-17 00:05:15,157 DEBUG &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: updates MTA        .190&lt;br/&gt;
2011-06-17 00:05:15,157 DEBUG &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: updates PRIME      3.250&lt;br/&gt;
2011-06-17 00:05:15,157 DEBUG &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: updates UST        .180&lt;br/&gt;
2011-06-17 00:05:15,157 INFO &lt;span class=&quot;error&quot;&gt;&amp;#91;Timer-0&amp;#93;&lt;/span&gt; com.leadpoint.syndication.db.mongo.mortgage.FinancialIndexTableUpdater - FinancialIndexTableUpdater: end update on Jun 17, 2011 00:05:15 size=8 table timestamp Jun 16, 2011 23:49:17&lt;/p&gt;</description>
                <environment>Resin app server on linux</environment>
        <key id="18385">JAVA-383</key>
            <summary>cursor.count() is positive, but cursor.hasNext() returns false</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="5">Cannot Reproduce</resolution>
                                        <assignee username="antoine">Antoine Girbal</assignee>
                                    <reporter username="joseph.wang">Joseph Wang </reporter>
                        <labels>
                    </labels>
                <created>Fri, 17 Jun 2011 00:29:19 +0000</created>
                <updated>Tue, 25 Jun 2013 16:51:19 +0000</updated>
                            <resolved>Mon, 24 Oct 2011 11:32:12 +0000</resolved>
                                    <version>2.5.2</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="38095" author="antoine" created="Fri, 17 Jun 2011 19:10:47 +0000"  >&lt;p&gt;Most likely it is not a java issue, but a race condition due to replication.&lt;br/&gt;
Do you still have issue if you do both:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;the client inserting docs uses safe writes, then notifies&lt;/li&gt;
	&lt;li&gt;the client processing docs doesnt use slaveOk&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In terms of solution, either:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;dont use slaveok&lt;/li&gt;
	&lt;li&gt;add a delay before processing, like 5min. Gracefully handle in case docs still not there (if replication stalled)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;thx&lt;br/&gt;
AG&lt;/p&gt;</comment>
                            <comment id="37975" author="knut" created="Fri, 17 Jun 2011 01:42:48 +0000"  >&lt;p&gt;This process runs every 15 minutes, but there is new data only once per day.  The error case happens very intermittently, once per month or two.&lt;br/&gt;
The setup is that one app (app A) creates a new collection and inserts all 8 documents.  It then signals another app (app B) on a different machine that the collection is ready.  App B then proceeds to load all documents.&lt;/p&gt;

&lt;p&gt;The error must also be very transient.  This only happens once within a few minutes of the collection&apos;s creation.  When the process runs again 15 minutes later all the data is perfectly fine and everything completes normally.  There are no updates or anything like that happening to the collection.  It says the same after the initial insert.&lt;/p&gt;

&lt;p&gt;The query is rather straight forward (in the attached java file).  One thing to be aware of is that the &quot;isValid()&quot; check on the FinancialIndex object depends only on the object itself.  The constructor is&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;	&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;public&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; FinancialIndex(BasicDBObject obj) {&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;this&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;.indexName = obj.getString(INDEX_NAME_FIELD_NAME);&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;this&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;.price = obj.getDouble(PRICE_FIELD_NAME);&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;		&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if&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;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;this&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;.indexName != &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;null&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; &amp;amp;&amp;amp; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;this&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;.indexName.length() &amp;gt; &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;0&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; &amp;amp;&amp;amp; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;this&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;.price &amp;gt; &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;0&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;.0d) {&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;this&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;.isValid = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;true&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;		}&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;	}&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;They all have a valid name and price, at least as soon as we run the query manually, or the second time it runs.&lt;/p&gt;

&lt;p&gt;Since we run with replica set and slave queries are OK it is possible that this could have something to do with replication.  If somehow metadata about a collection are available before the data within the collection.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="12087" name="FinancialIndexTableUpdater.java" size="4585" author="joseph.wang" created="Fri, 17 Jun 2011 00:30:18 +0000"/>
                    </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|hrhbxz:</customfieldvalue>

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