<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:12 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>[CSHARP-1298] Mongo DB Connection Issue - &quot; MongoDB.Driver.MongoConnectionException: Unable to connect in the specified timeframe of &apos;00:00:30&apos; &quot;</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1298</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Can Any body help me how to make  connection string for MongoDB if conditional are as follows-&lt;br/&gt;
 Database Name - ABC&lt;br/&gt;
 Server Name - DEF1,DEF2&lt;br/&gt;
 UserName - ankur&lt;br/&gt;
 Password - ankur123&lt;br/&gt;
I have Created at My End below&lt;br/&gt;
&quot;mongodb://ankur:ankur123@DEF1:27017,DEF2:27017/ABC?maxpoolsize=250;authSource=$external;authMechanism=PLAIN;safe=true&quot;&lt;br/&gt;
and Error Occur - Exception: MongoDB.Driver.MongoConnectionException: Unable to connect in the specified timeframe of &apos;00:00:30&apos;.&lt;br/&gt;
Thanks.&lt;/p&gt;</description>
                <environment>Visual Studio on Windows7</environment>
        <key id="206730">CSHARP-1298</key>
            <summary>Mongo DB Connection Issue - &quot; MongoDB.Driver.MongoConnectionException: Unable to connect in the specified timeframe of &apos;00:00:30&apos; &quot;</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="craig.wilson@mongodb.com">Craig Wilson</assignee>
                                    <reporter username="ankurjasoriya@gmail.com">Ankur Jasoria</reporter>
                        <labels>
                            <label>query</label>
                            <label>question</label>
                    </labels>
                <created>Wed, 27 May 2015 12:56:19 +0000</created>
                <updated>Tue, 16 Nov 2021 15:34:00 +0000</updated>
                            <resolved>Wed, 17 Jun 2015 13:56:12 +0000</resolved>
                                    <version>1.10</version>
                                                    <component>Connectivity</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="1489817" author="rajun" created="Wed, 1 Feb 2017 12:09:59 +0000"  >&lt;p&gt;I am not able to connect to mongodb using connect-mdbc from powershell.&lt;br/&gt;
Connect-Mdbc : Unable to connect in the specified timeframe of &apos;00:00:30&apos;.&lt;/p&gt;
</comment>
                            <comment id="1434264" author="craiggwilson" created="Tue, 15 Nov 2016 12:17:43 +0000"  >&lt;p&gt;It was related to not being specific enough in the connection string. For instance, if you are talking to a replica set, you should specify the the replica set name in the connection string.&lt;/p&gt;</comment>
                            <comment id="1434229" author="kumaadd" created="Tue, 15 Nov 2016 10:36:54 +0000"  >&lt;p&gt;Getting the same error with mongo driver version: 1.10.0.62&lt;br/&gt;
 MongoDB.Driver.MongoConnectionException: Unable to connect in the specified timeframe of &apos;00:00:30&apos;.&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.Discover(TimeSpan timeout)&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.EnsureInstanceManager(TimeSpan timeout)&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.ChooseServerInstance(ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoServer.RequestStart(MongoDatabase initialDatabase, ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RequestStart(ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RequestStart()&lt;/p&gt;

&lt;p&gt;The issue seems closed so what was the resolution ?&lt;/p&gt;</comment>
                            <comment id="1065310" author="comrade17" created="Tue, 20 Oct 2015 10:13:27 +0000"  >&lt;p&gt;Thank you, Craig! It works very well!&lt;/p&gt;</comment>
                            <comment id="1062851" author="craiggwilson" created="Fri, 16 Oct 2015 15:04:14 +0000"  >&lt;p&gt;Absolutely... Let me know if that fixes the issue.&lt;/p&gt;</comment>
                            <comment id="1062830" author="comrade17" created="Fri, 16 Oct 2015 14:50:16 +0000"  >&lt;p&gt;Thank you for your answer, Craig! I&apos;ll test it. We have a replica set in our system.&lt;br/&gt;
But may I use MongoClientSettings instead of connection string?&lt;/p&gt;

&lt;p&gt;Like this:&lt;/p&gt;

&lt;p&gt;var credential = MongoCredential.CreateMongoCRCredential(_dataBaseName, _login, _password);&lt;br/&gt;
var settings = new MongoClientSettings&lt;br/&gt;
	{&lt;br/&gt;
		Credentials = new[]&lt;/p&gt;
{credential}
&lt;p&gt;,&lt;br/&gt;
		Servers = PrepareServersForConnection(),&lt;br/&gt;
		ReplicaSetName = &quot;AlarusReplicaSet&quot;&lt;br/&gt;
	};&lt;br/&gt;
 var mongoClient = new MongoClient(settings);&lt;/p&gt;</comment>
                            <comment id="1062674" author="craiggwilson" created="Fri, 16 Oct 2015 12:26:58 +0000"  >&lt;p&gt;Hi Mikhail,&lt;/p&gt;

&lt;p&gt;Since the problem seems to be around the DiscoveringMongoServerProxy, you can completely avoid this by telling us in the connection string what type of mongo cluster you are connecting to. For instance, if you are connecting to a replica set, provide the replica set name in the connection string: &lt;tt&gt;replicaSet=mySetName&lt;/tt&gt;. If you are connecting to a shard router, provide the option &lt;tt&gt;connect=ShardRouter&lt;/tt&gt; in the connection string.&lt;/p&gt;

&lt;p&gt;I&apos;m not saying we don&apos;t have a bug here, but this should work around your problem for the time being.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="1062598" author="comrade17" created="Fri, 16 Oct 2015 09:38:52 +0000"  >&lt;p&gt;We have the same issue. The interesting thing is that sometimes we have this exception:&lt;/p&gt;

&lt;p&gt;MongoDB.Driver.MongoConnectionException: Unable to connect to server 192.168.100.101:27017: No connection could be made because the target machine actively refused it 192.168.100.101:27017. ---&amp;gt; System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 192.168.100.101:27017&lt;br/&gt;
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)&lt;br/&gt;
   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)&lt;br/&gt;
   at System.Net.Sockets.TcpClient.Connect(IPEndPoint remoteEP)&lt;br/&gt;
   at MongoDB.Driver.Internal.MongoConnection.Open()&lt;br/&gt;
   at MongoDB.Driver.Internal.MongoConnection.GetNetworkStream()&lt;br/&gt;
   at MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer, Int32 requestId)&lt;br/&gt;
   at MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message)&lt;br/&gt;
   at MongoDB.Driver.Operations.CommandOperation`1.Execute(MongoConnection connection)&lt;br/&gt;
   at MongoDB.Driver.MongoServerInstance.RunCommandAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TCommandResult&amp;#93;&lt;/span&gt;(MongoConnection connection, String databaseName, IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection)&lt;br/&gt;
   at MongoDB.Driver.MongoServerInstance.Connect()&lt;br/&gt;
   at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)&lt;br/&gt;
   &amp;#8212; End of inner exception stack trace &amp;#8212;&lt;br/&gt;
   at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.Internal.DirectMongoServerProxy.ChooseServerInstance(ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoServer.AcquireConnection(ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.GetCollectionNames()&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.CollectionExists(String collectionName)&lt;/p&gt;

&lt;p&gt;But sometimes this:&lt;/p&gt;

&lt;p&gt;MongoDB.Driver.MongoConnectionException: Unable to connect in the specified timeframe of &apos;00:00:30&apos;.&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.Discover(TimeSpan timeout)&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.EnsureInstanceManager(TimeSpan timeout)&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.ChooseServerInstance(ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoServer.AcquireConnection(ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.GetCollectionNames()&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.CollectionExists(String collectionName)&lt;/p&gt;

&lt;p&gt;We found this exceptions during testing the case, when MongoDB starts after our application. There are two possible ways further: if we have the first type exception, then after starting of Mongo our Application can successfully connect to MongoDB: if we face with the second type exception, then the the Application cannot connect to MongoDB even after Mongo started,&lt;/p&gt;</comment>
                            <comment id="925670" author="sternr-windowslive" created="Thu, 28 May 2015 10:08:25 +0000"  >&lt;p&gt;The same issue happend to us as well using driver version 1.10.0.62.&lt;br/&gt;
Just to add, while suffering from this error, we were able to connect to Mongo just fine using: the mongo.exe and a test executable. restarting Mongo didn&apos;t solve the issue. only restarting our application (which we can&apos;t do...) seemed to solve the issue.&lt;/p&gt;</comment>
                            <comment id="924778" author="craiggwilson" created="Wed, 27 May 2015 15:56:51 +0000"  >&lt;p&gt;Thanks Ankur. &lt;/p&gt;

&lt;p&gt;I&apos;m having a hard time reconciling your stack trace with the 2.0 driver. Would you mind taking a screenshot of the properties window of the MongoDB.Driver.dll?&lt;/p&gt;

&lt;p&gt;1. Find the MongoDB.Driver.dll on your system.&lt;br/&gt;
2. Right-click it and choose Properties&lt;br/&gt;
3. Select the Details tab&lt;br/&gt;
4. Take a screen shot&lt;br/&gt;
5. upload the screenshot to this ticket&lt;/p&gt;

&lt;p&gt;The product version and file version on that tab should include the version of the driver your using.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Craig&lt;/p&gt;</comment>
                            <comment id="924704" author="ankurjasoriya@gmail.com" created="Wed, 27 May 2015 15:20:03 +0000"  >&lt;p&gt;Craig,&lt;/p&gt;

&lt;p&gt;We are working on updated one.&lt;/p&gt;

&lt;p&gt;Thanks&lt;br/&gt;
Ankur&lt;/p&gt;</comment>
                            <comment id="924679" author="craiggwilson" created="Wed, 27 May 2015 15:03:35 +0000"  >&lt;p&gt;Ankur,&lt;/p&gt;

&lt;p&gt;In the AffectsVersion property, you have used 2.0. This stack trace is from a previous version of the driver. Could you please confirm what version of the driver you are using?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Craig&lt;/p&gt;</comment>
                            <comment id="924675" author="ankurjasoriya@gmail.com" created="Wed, 27 May 2015 15:01:57 +0000"  >&lt;p&gt;Hi Craig,&lt;/p&gt;

&lt;p&gt;Thanks for your quick reply !! &lt;br/&gt;
I am sharing you stack track also &lt;/p&gt;

&lt;p&gt;Exception: MongoDB.Driver.MongoConnectionException: Unable to connect in the specified timeframe of &apos;00:00:30&apos;.&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.Discover(TimeSpan timeout)&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.EnsureInstanceManager(TimeSpan timeout)&lt;br/&gt;
   at MongoDB.Driver.Internal.DiscoveringMongoServerProxy.ChooseServerInstance(ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoServer.AcquireConnection(ReadPreference readPreference)&lt;br/&gt;
   at MongoDB.Driver.MongoCursor`1.MongoCursorConnectionProvider.AcquireConnection()&lt;br/&gt;
   at MongoDB.Driver.Operations.QueryOperation`1.GetFirstBatch(IConnectionProvider connectionProvider)&lt;br/&gt;
   at MongoDB.Driver.Operations.QueryOperation`1.Execute(IConnectionProvider connectionProvider)&lt;br/&gt;
   at System.Linq.Enumerable.FirstOrDefault&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection.FindOneAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(FindOneArgs args)&lt;br/&gt;
   at MongoRepository.MongoRepository`1.GetById(String collection, String id, String debugmode_)&lt;br/&gt;
   at Fareportal.Crm.Services.NoteService.DefaultNoteService.Save(DefaultNote note_, String debugmode_),Inner Exception:,AnonymousId rBILP1U3gSOpul7QDddmAgabcdeAB==&quot;,&lt;/p&gt;

&lt;p&gt;I have also figure out on these issue and here authentication working fine. At my end I am working at server end to figure out the issue if any issue at server end ?&lt;/p&gt;

&lt;p&gt;If issue at code part end or MongoDB Driver end please figure out.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;br/&gt;
Ankur&lt;/p&gt;
</comment>
                            <comment id="924495" author="craiggwilson" created="Wed, 27 May 2015 13:00:03 +0000"  >&lt;p&gt;Hi Ankur,&lt;/p&gt;

&lt;p&gt;Sorry you are having some trouble. Your connection string looks fine, but obviously there is a problem connecting to your servers. &lt;/p&gt;

&lt;p&gt;1. There should be a lot more information in that exception than you are providing. Could you confirm that and, if so, please provide the entire stack trace?&lt;/p&gt;

&lt;p&gt;2. The PLAIN mechanism is for using LDAP. I assume this is all setup and what you are wanting. Chances are that there is an authentication problem, and having the more full stack trace from (1) should help us identify that.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Craig&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|hs9q2n:</customfieldvalue>

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