<!-- 
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-382] NPE in ReplicaSetStatus.ensureMaster</title>
                <link>https://jira.mongodb.org/browse/JAVA-382</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;After initializing a Mongo object I sometimes get a NPE when I first try to use that instance.&lt;/p&gt;

&lt;p&gt;java.lang.NullPointerException&lt;br/&gt;
        at&lt;br/&gt;
 com.mongodb.ReplicaSetStatus.ensureMaster(ReplicaSetStatus.java:301)&lt;br/&gt;
        at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:&lt;br/&gt;
383)&lt;br/&gt;
        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:192)&lt;br/&gt;
        at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:&lt;br/&gt;
295)&lt;br/&gt;
        at com.mongodb.DB.getCollectionNames(DB.java:259)&lt;br/&gt;
        at com.mongodb.DB.collectionExists(DB.java:300)&lt;br/&gt;
        at&lt;br/&gt;
net.avail.db.mongodb.MongoHourlyMetricsAggregator.ensureCollectionsExists(MongoHourlyMetricsAggregator.java:&lt;br/&gt;
43) &lt;/p&gt;

&lt;p&gt;Expected:&lt;/p&gt;

&lt;p&gt;Better concurrency handling and on an unexpected error such as no master found a more descriptive exception than a NPE.&lt;/p&gt;</description>
                <environment></environment>
        <key id="18345">JAVA-382</key>
            <summary>NPE in ReplicaSetStatus.ensureMaster</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="antoine">Antoine Girbal</assignee>
                                    <reporter username="jon.ivmark">Jon Ivmark</reporter>
                        <labels>
                            <label>concurrency</label>
                            <label>replication</label>
                    </labels>
                <created>Thu, 16 Jun 2011 07:30:58 +0000</created>
                <updated>Wed, 10 Aug 2011 05:33:36 +0000</updated>
                            <resolved>Thu, 23 Jun 2011 22:20:52 +0000</resolved>
                                    <version>2.5.3</version>
                                    <fixVersion>2.6.4</fixVersion>
                                    <component>Cluster Management</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="38980" author="auto" created="Thu, 23 Jun 2011 22:19:16 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;agirbal&apos;, u&apos;name&apos;: u&apos;agirbal&apos;, u&apos;email&apos;: u&apos;antoine@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-382&quot; title=&quot;NPE in ReplicaSetStatus.ensureMaster&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-382&quot;&gt;&lt;del&gt;JAVA-382&lt;/del&gt;&lt;/a&gt;: NPE in ReplicaSetStatus.ensureMaster&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/719b6b7851f9b50b918f232027e1c55f9c33772c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/719b6b7851f9b50b918f232027e1c55f9c33772c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="38671" author="jon.ivmark" created="Wed, 22 Jun 2011 07:49:04 +0000"  >&lt;p&gt;I got the same exception using 2.6.3:&lt;/p&gt;

&lt;p&gt;java.lang.NullPointerException&lt;br/&gt;
	at com.mongodb.ReplicaSetStatus.ensureMaster(ReplicaSetStatus.java:318)&lt;br/&gt;
	at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:393)&lt;br/&gt;
	at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:198)&lt;br/&gt;
	at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:296)&lt;br/&gt;
	at com.mongodb.DB.getCollectionNames(DB.java:259)&lt;br/&gt;
	at com.mongodb.DB.collectionExists(DB.java:300)&lt;br/&gt;
	at net.avail.db.mongodb.MongoHourlyMetricsAggregator.ensureCollectionsExists(MongoHourlyMetricsAggregator.java:43)&lt;/p&gt;

&lt;p&gt;The patch solves the NPE (and now a MongoException will be thrown insterad?), but why is there no master node found initially? How are you supposed to handle this on the client, catch MongoException and retry can&apos;t really be the recommended way?&lt;/p&gt;

&lt;p&gt;Jon&lt;/p&gt;</comment>
                            <comment id="38332" author="testn" created="Mon, 20 Jun 2011 15:46:15 +0000"  >&lt;p&gt;add the patch&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="12098" name="JAVA-382.patch" size="1013" author="testn" created="Mon, 20 Jun 2011 15:46:15 +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|hrhby7:</customfieldvalue>

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