<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:43 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-627] readPreference=nearest fails sometimes</title>
                <link>https://jira.mongodb.org/browse/JAVA-627</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;My java program performs some queries which fail only when the read preference is set to nearest (either through a mongo uri with readPreference=nearest, or by setting it in the Java code). The cluster I&apos;m using has 4 replica sets, each one with a primary and a secondary. The query I&apos;m trying to perform is similar to:&lt;br/&gt;
db.mycollection.find(&quot;_id&quot;, &quot;JC &amp;amp;|1100222232010210&quot;)&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;    public byte[] searchEquals(String table, String key) {&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;        DBCollection col = db.getCollection(table);&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;        DBObject o = new BasicDBObject(&quot;_id&quot;, key);&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;        DBObject oo = col.findOne(o, id);&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;        if(oo==null) throw new RuntimeException(&quot;Mongo searching &quot;+table+&quot; for ==&quot;+key+&quot; resulted in nothing.&quot;);&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;        return ((String)oo.get(&quot;_id&quot;)).getBytes();&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;When running the method when the read preference is set to nearest, it throws the exception after running a few queries successfully. When running without read preference set to nearest, it doesn&apos;t throw the error.&lt;/p&gt;</description>
                <environment>2.9.0-RC2 drivers, CentOS5, Mongo v. 2.0.6</environment>
        <key id="47890">JAVA-627</key>
            <summary>readPreference=nearest fails sometimes</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="dufflebunk">Paul Mahon</reporter>
                        <labels>
                    </labels>
                <created>Wed, 22 Aug 2012 22:00:06 +0000</created>
                <updated>Tue, 25 Jun 2013 16:51:15 +0000</updated>
                            <resolved>Thu, 23 Aug 2012 00:49:44 +0000</resolved>
                                    <version>2.9.0</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="155947" author="jeff.yemin" created="Thu, 23 Aug 2012 00:49:31 +0000"  >&lt;p&gt;It&apos;s still a bit strange that you got back null though, rather than exception.  Please post to mongodb-user if you don&apos;t get to the bottom of this yourself.&lt;/p&gt;</comment>
                            <comment id="155941" author="dufflebunk" created="Thu, 23 Aug 2012 00:23:01 +0000"  >&lt;p&gt;This may not be related to the Java API. The cluster ended up with a very large number of connections on the mongod processes for some reason. The number is slowly coming down. If I cannot reproduce with the connection count low, I&apos;ll close this bug as invalid.&lt;/p&gt;</comment>
                            <comment id="155935" author="dufflebunk" created="Wed, 22 Aug 2012 23:47:03 +0000"  >&lt;p&gt;Waiting a bit has no effect. Also the readPreference is not related. I managed to get the errors once with readPreference=secondary. It failed about 10% of the times I ran it. &lt;/p&gt;

&lt;p&gt;I have been unable to cause the errors when I list only a single mongos.&lt;/p&gt;</comment>
                            <comment id="155932" author="dufflebunk" created="Wed, 22 Aug 2012 23:39:25 +0000"  >&lt;p&gt;I should add that the program is multi-threaded, and I&apos;m usually running it with 8-20 threads running queries.&lt;/p&gt;</comment>
                            <comment id="155931" author="dufflebunk" created="Wed, 22 Aug 2012 23:38:25 +0000"  >&lt;p&gt;I&apos;m having some trouble reliably reproducing it. Sometimes I&apos;ll run it and it&apos;ll fail, and then if I run it again it&apos;ll succeed. Earlier today it was failing every time I ran it with nearest. Now it&apos;s failing only rarely with nearest. I think it fails more often if I don&apos;t run any queries for a few minutes, but I&apos;m not sure.&lt;/p&gt;

&lt;p&gt;I&apos;ll see if I can get it to fail with just one mongos given.&lt;/p&gt;</comment>
                            <comment id="155927" author="jeff.yemin" created="Wed, 22 Aug 2012 23:15:03 +0000"  >&lt;p&gt;Can you try with a single mongos instead of a list?  I want to rule out a bug in the mongos failover code.&lt;/p&gt;</comment>
                            <comment id="155926" author="dufflebunk" created="Wed, 22 Aug 2012 23:10:39 +0000"  >&lt;p&gt;Yes, 4 shards, using 2.0.6. The mongo URI I used to create the Mongo object lists all the mongos servers.&lt;/p&gt;</comment>
                            <comment id="155921" author="jeff.yemin" created="Wed, 22 Aug 2012 22:48:55 +0000"  >&lt;p&gt;To confirm: your cluster is sharded and the java driver is connecting to a mongos, and your mongos version is 2.0.6?&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|hrhaxz:</customfieldvalue>

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