<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:05 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-793] Race condition in com.mongodb.DBTCPConnector#authenticate method</title>
                <link>https://jira.mongodb.org/browse/JAVA-793</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;It&apos;s possible for _masterPortPool to be null in the call to MyPort.get from DBTCPConnector.authenticate, causing this mis-leading exception to be thrown:&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;throw new MongoException(&quot;Rare case where master=null, probably all servers are down&quot;);&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;This can be reproduced reliably when constructing a MongoClient with a List of mongos nodes and a call to DB.authenticate is the first operation on the MongoClient (as is typical).&lt;/p&gt;

&lt;p&gt;This issue can be worked around by replacing the call to DB.authenticate with a call to the MongoClient constructor that takes a List&amp;lt;MongoCredential&amp;gt;: &lt;a href=&quot;http://api.mongodb.org/java/current/com/mongodb/MongoClient.html#MongoClient(java.util.List&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://api.mongodb.org/java/current/com/mongodb/MongoClient.html#MongoClient(java.util.List&lt;/a&gt;, java.util.List, com.mongodb.MongoClientOptions).&lt;/p&gt;
</description>
                <environment></environment>
        <key id="69819">JAVA-793</key>
            <summary>Race condition in com.mongodb.DBTCPConnector#authenticate method</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="jeff.yemin@mongodb.com">Jeffrey Yemin</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Mar 2013 20:29:52 +0000</created>
                <updated>Mon, 28 Jul 2014 13:48:22 +0000</updated>
                            <resolved>Mon, 8 Apr 2013 14:53:50 +0000</resolved>
                                    <version>2.11.0</version>
                                    <fixVersion>2.11.1</fixVersion>
                    <fixVersion>2.12.0</fixVersion>
                                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="300047" author="jeff.yemin" created="Wed, 27 Mar 2013 18:09:03 +0000"  >&lt;p&gt;No problem.  We&apos;ll likely wait a little while before cutting 2.11.1, just in case any other high priority bugs come through.&lt;/p&gt;</comment>
                            <comment id="300046" author="chriscurtin" created="Wed, 27 Mar 2013 18:08:06 +0000"  >&lt;p&gt;That worked. No more errors while authenticating. Quick query/insert tests also worked okay.&lt;/p&gt;

&lt;p&gt;Thanks for the fast turn around!&lt;/p&gt;</comment>
                            <comment id="300024" author="jeff.yemin" created="Wed, 27 Mar 2013 17:54:15 +0000"  >&lt;p&gt;Can you test out a new build with a fix for this issue?  You can get it here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/2.11.1-SNAPSHOT/mongo-java-driver-2.11.1-20130327.175252-1.jar&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/2.11.1-SNAPSHOT/mongo-java-driver-2.11.1-20130327.175252-1.jar&lt;/a&gt;&lt;/p&gt;
</comment>
                            <comment id="300021" author="auto" created="Wed, 27 Mar 2013 17:51:48 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-03-27T17:39:12Z&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-793&quot; title=&quot;Race condition in com.mongodb.DBTCPConnector#authenticate method&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-793&quot;&gt;&lt;del&gt;JAVA-793&lt;/del&gt;&lt;/a&gt;: Fixed race condition in DBTCPConnector.authenticate by putting in a call to checkMaster prior to getting a DBPort to authenticate on.&lt;br/&gt;
Branch: 2.11.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/c4a4d7ca7a9c22c4a4e26de04b763f4cdad8b650&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/c4a4d7ca7a9c22c4a4e26de04b763f4cdad8b650&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="300012" author="auto" created="Wed, 27 Mar 2013 17:43:19 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-03-27T17:39:12Z&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-793&quot; title=&quot;Race condition in com.mongodb.DBTCPConnector#authenticate method&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-793&quot;&gt;&lt;del&gt;JAVA-793&lt;/del&gt;&lt;/a&gt;: Fixed race condition in DBTCPConnector.authenticate by putting in a call to checkMaster prior to getting a DBPort to authenticate on.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/9c3d8c80feb043a1b565186956548a7cc5de04d1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/9c3d8c80feb043a1b565186956548a7cc5de04d1&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="300000" author="chriscurtin" created="Wed, 27 Mar 2013 17:33:45 +0000"  >&lt;p&gt;Yes, the servers are mongos processes. I&apos;ve tested with both a single server and a set of servers and the same problem occurs.&lt;/p&gt;

&lt;p&gt;Is there a debug level or something I can turn on to get more details?&lt;/p&gt;</comment>
                            <comment id="299991" author="jeff.yemin" created="Wed, 27 Mar 2013 17:28:28 +0000"  >&lt;p&gt;Hi Chris,&lt;/p&gt;

&lt;p&gt;Just to confirm: the list of servers you are providing are a list of mongos nodes, not a list of replica set members, correct?  I want to make sure there&apos;s not something wrong with the discovery process.&lt;/p&gt;</comment>
                            <comment id="299970" author="chriscurtin" created="Wed, 27 Mar 2013 17:13:24 +0000"  >&lt;p&gt;First, the error occurs immediately, not after 10 seconds as suggested in the mailing list thread.&lt;/p&gt;

&lt;p&gt;Here is the stack of running threads. First is when I successfully auth using the &lt;/p&gt;

&lt;p&gt;   MongoClient(List&amp;lt;ServerAddress&amp;gt; seeds, List&amp;lt;MongoCredential&amp;gt; credentialsList, MongoClientOptions options) as suggested in the mailing list.&lt;/p&gt;

&lt;p&gt;Second is when I use DB.authenticate which fails.&lt;/p&gt;

&lt;p&gt;Both cases are thread dumps from IntelliJ when I set a &apos;sleep&apos; as the last thing in the main() so I could capture the threads.&lt;/p&gt;

&lt;p&gt;Success:&lt;/p&gt;

&lt;p&gt;MongosStatus:MongosUpdater@361 daemon, prio=5, in group &apos;main&apos;, status: &apos;SLEEPING&apos;&lt;br/&gt;
	  at java.lang.Thread.sleep(Thread.java:-1)&lt;br/&gt;
	  at com.mongodb.MongosStatus$MongosUpdater.run(MongosStatus.java:79)&lt;/p&gt;

&lt;p&gt;MongoCleaner516992923@303 daemon, prio=5, in group &apos;main&apos;, status: &apos;SLEEPING&apos;&lt;br/&gt;
	  at java.lang.Thread.sleep(Thread.java:-1)&lt;br/&gt;
	  at com.mongodb.Mongo$CursorCleanerThread.run(Mongo.java:773)&lt;/p&gt;

&lt;p&gt;Attach Listener@620 daemon, prio=5, in group &apos;system&apos;, status: &apos;RUNNING&apos;&lt;/p&gt;

&lt;p&gt;Signal Dispatcher@621 daemon, prio=9, in group &apos;system&apos;, status: &apos;RUNNING&apos;&lt;/p&gt;

&lt;p&gt;Finalizer@622 daemon, prio=8, in group &apos;system&apos;, status: &apos;WAIT&apos;&lt;br/&gt;
	  at java.lang.Object.wait(Object.java:-1)&lt;br/&gt;
	  at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)&lt;br/&gt;
	  at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)&lt;br/&gt;
	  at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)&lt;/p&gt;

&lt;p&gt;Reference Handler@623 daemon, prio=10, in group &apos;system&apos;, status: &apos;WAIT&apos;&lt;br/&gt;
	  at java.lang.Object.wait(Object.java:-1)&lt;br/&gt;
	  at java.lang.Object.wait(Object.java:485)&lt;br/&gt;
	  at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)&lt;/p&gt;

&lt;p&gt;main@1, prio=5, in group &apos;main&apos;, status: &apos;RUNNING&apos;&lt;br/&gt;
	  at com.silverpop.mongodb.basic.ConnectionTesting.main(ConnectionTesting.java:45)&lt;/p&gt;



&lt;p&gt;Failure:&lt;/p&gt;

&lt;p&gt;MongosStatus:MongosUpdater@363 daemon, prio=5, in group &apos;main&apos;, status: &apos;SLEEPING&apos;&lt;br/&gt;
	  at java.lang.Thread.sleep(Thread.java:-1)&lt;br/&gt;
	  at com.mongodb.MongosStatus$MongosUpdater.run(MongosStatus.java:79)&lt;/p&gt;

&lt;p&gt;MongoCleaner1751161119@299 daemon, prio=5, in group &apos;main&apos;, status: &apos;SLEEPING&apos;&lt;br/&gt;
	  at java.lang.Thread.sleep(Thread.java:-1)&lt;br/&gt;
	  at com.mongodb.Mongo$CursorCleanerThread.run(Mongo.java:773)&lt;/p&gt;

&lt;p&gt;Attach Listener@370 daemon, prio=5, in group &apos;system&apos;, status: &apos;RUNNING&apos;&lt;/p&gt;

&lt;p&gt;Signal Dispatcher@371 daemon, prio=9, in group &apos;system&apos;, status: &apos;RUNNING&apos;&lt;/p&gt;

&lt;p&gt;Finalizer@372 daemon, prio=8, in group &apos;system&apos;, status: &apos;WAIT&apos;&lt;br/&gt;
	  at java.lang.Object.wait(Object.java:-1)&lt;br/&gt;
	  at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)&lt;br/&gt;
	  at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)&lt;br/&gt;
	  at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)&lt;/p&gt;

&lt;p&gt;Reference Handler@373 daemon, prio=10, in group &apos;system&apos;, status: &apos;WAIT&apos;&lt;br/&gt;
	  at java.lang.Object.wait(Object.java:-1)&lt;br/&gt;
	  at java.lang.Object.wait(Object.java:485)&lt;br/&gt;
	  at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)&lt;/p&gt;

&lt;p&gt;main@1, prio=5, in group &apos;main&apos;, status: &apos;RUNNING&apos;&lt;br/&gt;
	  at com.silverpop.mongodb.basic.ConnectionTesting.main(ConnectionTesting.java:45)&lt;/p&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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|hrmxwv:</customfieldvalue>

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