<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:47 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-227] NPE when replica set is down</title>
                <link>https://jira.mongodb.org/browse/JAVA-227</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;When the whole replica set is down, java driver generates this log message every 5 seconds.&lt;/p&gt;

&lt;p&gt;2010-12-06 14:35:10,294 ERROR &lt;span class=&quot;error&quot;&gt;&amp;#91;STDERR&amp;#93;&lt;/span&gt; (ReplicaSetStatus:Updater) Dec 6, 2010 2:35:10 PM com.mongodb.ReplicaSetStatus$Node update&lt;br/&gt;
SEVERE: can&apos;t update node: shared-mongo-004.1515.mtvi.com:27017&lt;br/&gt;
java.lang.NullPointerException&lt;br/&gt;
        at com.mongodb.OutMessage.reset(OutMessage.java:73)&lt;br/&gt;
        at com.mongodb.OutMessage.&amp;lt;init&amp;gt;(OutMessage.java:51)&lt;br/&gt;
        at com.mongodb.OutMessage.query(OutMessage.java:38)&lt;br/&gt;
        at com.mongodb.DBPort.findOne(DBPort.java:142)&lt;br/&gt;
        at com.mongodb.DBPort.runCommand(DBPort.java:159)&lt;br/&gt;
        at com.mongodb.ReplicaSetStatus$Node.update(ReplicaSetStatus.java:119)&lt;br/&gt;
        at com.mongodb.ReplicaSetStatus.updateAll(ReplicaSetStatus.java:277)&lt;br/&gt;
        at com.mongodb.ReplicaSetStatus$Updater.run(ReplicaSetStatus.java:238)&lt;/p&gt;

&lt;p&gt;Seems like an NPE is not what should happen.  Strange thing is that OutMessage.java:73 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;   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;        _id = ID.getAndIncrement();&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;and I&apos;m not sure how that line could generate an NPE. &lt;/p&gt;
</description>
                <environment>1.62 linux 64 bit server</environment>
        <key id="13880">JAVA-227</key>
            <summary>NPE when replica set is down</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="jeff_y">Jeff Yemin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 6 Dec 2010 21:45:51 +0000</created>
                <updated>Thu, 17 Mar 2011 19:13:53 +0000</updated>
                            <resolved>Thu, 17 Feb 2011 19:13:48 +0000</resolved>
                                    <version>2.3</version>
                                    <fixVersion>2.5</fixVersion>
                                    <component>Cluster Management</component>
                                        <votes>2</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="24130" author="antoine" created="Thu, 17 Feb 2011 19:13:48 +0000"  >&lt;p&gt;will reopen if issues is brought up again.&lt;/p&gt;</comment>
                            <comment id="24129" author="jeff.yemin@mtvstaff.com" created="Thu, 17 Feb 2011 19:02:26 +0000"  >&lt;p&gt;I haven&apos;t see it again, but I haven&apos;t brought down the replica set entirely.  This is definitely not high priority for us though.&lt;/p&gt;</comment>
                            <comment id="24110" author="antoine" created="Thu, 17 Feb 2011 07:54:15 +0000"  >&lt;p&gt;let me know if you are still experiencing the problem with newest driver.&lt;br/&gt;
If not I&apos;ll close ticket thx&lt;/p&gt;</comment>
                            <comment id="21369" author="antoine" created="Mon, 13 Dec 2010 16:44:43 +0000"  >&lt;p&gt;I attached a jar file that has a new init block for the ID field.&lt;/p&gt;

&lt;p&gt;    private final static AtomicInteger ID;&lt;/p&gt;

&lt;p&gt;    static &lt;/p&gt;
{
        ID = new AtomicInteger(1);
    }

&lt;p&gt;let me know if it makes any difference.&lt;br/&gt;
Note this .jar is from trunk and should not be used in production.&lt;/p&gt;</comment>
                            <comment id="21292" author="jeff_y" created="Fri, 10 Dec 2010 14:23:36 +0000"  >&lt;p&gt;I tried with a simple test program and couldn&apos;t reproduce it, which is not surprising.&lt;/p&gt;</comment>
                            <comment id="21289" author="grmblfrz" created="Fri, 10 Dec 2010 13:18:16 +0000"  >&lt;p&gt;I&apos;m seeing the very same symptom with glassfish 2.1.1&lt;/p&gt;</comment>
                            <comment id="21132" author="antoine" created="Tue, 7 Dec 2010 04:22:16 +0000"  >&lt;p&gt;ok well maybe jboss reorders the loading of class, and does not initialize the ID first.&lt;br/&gt;
No matter how we fix this, it may be a problem in other parts of code too.&lt;br/&gt;
You should probably open a ticket with JBoss to mention the bug.&lt;/p&gt;

&lt;p&gt;If you have ability to compile, could you try:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;make the ID static final like&lt;br/&gt;
    final static AtomicInteger ID = new AtomicInteger(1);&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;move the query() method to end of class&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;if above doesnt work, then replace line with static block:&lt;br/&gt;
static AtomicInteger ID;&lt;br/&gt;
static {&lt;br/&gt;
ID = new AtomicInteger(1);&lt;br/&gt;
}&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;if that doesnt work, we can always add a catch for NPE errors and then initialize ID, but it&apos;s sad.&lt;/p&gt;</comment>
                            <comment id="21126" author="jeff_y" created="Mon, 6 Dec 2010 23:18:52 +0000"  >&lt;p&gt;So far only seen it after restarting our app with replica set already down (all nodes in replica set are unreachable).&lt;/p&gt;</comment>
                            <comment id="21125" author="antoine" created="Mon, 6 Dec 2010 22:53:00 +0000"  >&lt;p&gt;That&apos;s very odd behavior, this ID is a static variable that should be initialized whenever class is loaded, before using any method from it.&lt;br/&gt;
Most likely due to JBoss class loader.&lt;br/&gt;
Maybe there is a workaround.&lt;br/&gt;
How exactly to you get it to happen?&lt;br/&gt;
Is is after restart of your app with replica down?&lt;br/&gt;
Or does it also happen if you run queries in your app, then take all replica down?&lt;/p&gt;
</comment>
                            <comment id="21124" author="jeff_y" created="Mon, 6 Dec 2010 22:48:35 +0000"  >&lt;p&gt;Also, don&apos;t see the NPE when the replica set is up.&lt;/p&gt;</comment>
                            <comment id="21122" author="jeff_y" created="Mon, 6 Dec 2010 22:21:05 +0000"  >&lt;p&gt;Also note that we are running this in JBoss 4.2.3, which has rather funky class-loading.&lt;/p&gt;</comment>
                            <comment id="21118" author="jeff_y" created="Mon, 6 Dec 2010 21:55:23 +0000"  >&lt;p&gt;Confirmed in debugger that OutMessage.ID is null.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="10664" name="mongo.jar" size="229267" author="antoine" created="Mon, 13 Dec 2010 16:45:00 +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|hrgip3:</customfieldvalue>

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