Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1167

Fail to connect to single node replication set

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0
    • Affects Version/s: 2.0
    • Component/s: Connectivity

      jTry to connect to single node replication set. It times out after 30 seconds.
      Repro with self hosted single node replication set. Server version: 2.8-rc4.
      Repro with a free tier on mongolab.com. Server version:2.8-rc4

      Not repro with below build:
      commit: '17f6aa690f717c34fe2eaec06b13c8863fa4febc', commitDate: '2015-01-13 11:41:51' "

      Suspected it was related to :
      commit 4efda752fdea47acbfdbc58ba88dbd7cfd8e63ef
      Author: rstam <robert@robertstam.org>
      Date: Wed Jan 14 23:09:23 2015 -0500
      CSHARP-1160: Enforce the distinction between Standalone and Direct.

      Call stack:

      Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.TimeoutException: Operation timed out after 00:00:30. ---> System.OperationCanceledException: The operation was canceled.
         at System.Threading.CancellationToken.ThrowOperationCanceledException()
         at MongoDB.Driver.Core.Clusters.Cluster.<WaitForDescriptionChangedAsync>d__1a.MoveNext() in c:\git\mongo-csharp-driver\src\MongoDB.Driver.Core\Core\Clusters\Cluster.cs:line 0
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at MongoDB.Driver.Core.Clusters.Cluster.<SelectServerAsync>d__8.MoveNext() in c:\git\mongo-csharp-driver\src\MongoDB.Driver.Core\Core\Clusters\Cluster.cs:line 252
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at MongoDB.Driver.Core.Bindings.ReadPreferenceBinding.<GetReadChannelSourceAsync>d__0.MoveNext() in c:\git\mongo-csharp-driver\src\MongoDB.Driver.Core\Core\Bindings\ReadPreferenceBinding.cs:line 51
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
         at MongoDB.Driver.Core.Operations.FindOperation`1.<ExecuteAsync>d__2.MoveNext() in c:\git\mongo-csharp-driver\src\MongoDB.Driver.Core\Core\Operations\FindOperation.cs:line 202
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at MongoDB.Driver.OperationExecutor.<ExecuteReadOperationAsync>d__0`1.MoveNext() in c:\git\mongo-csharp-driver\src\MongoDB.Driver\OperationExecutor.cs:line 0
         --- End of inner exception stack trace ---
         at MongoDB.Driver.OperationExecutor.<ExecuteReadOperationAsync>d__0`1.MoveNext() in c:\git\mongo-csharp-driver\src\MongoDB.Driver\OperationExecutor.cs:line 43
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at MongoDB.Driver.MongoCollectionImpl`1.<ExecuteReadOperation>d__47`1.MoveNext() in c:\git\mongo-csharp-driver\src\MongoDB.Driver\MongoCollectionImpl.cs:line 0
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at MongoDB.Driver.IAsyncCursorSourceExtensions.<ToListAsync>d__14`1.MoveNext() in c:\git\mongo-csharp-driver\src\MongoDB.Driver.Core\IAsyncCursorSource.cs:line 63
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
         at mdbclient_cs.Program.<Run>d__0.MoveNext() in c:\dev\mdbclient\mdbclient-cs\Program.cs:line 31
         --- End of inner exception stack trace ---
         at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
         at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
         at System.Threading.Tasks.Task.Wait()
         at mdbclient_cs.Program.Main(String[] args) in c:\dev\mdbclient\mdbclient-cs\Program.cs:line 16
      

      Code:

                  var cnnString = "mongodb://<useName>:<pwd>@dsxxx.mongolab.com:53617/db01";
      
                  var mongoUrl = new MongoUrl(cnnString);
                  var client = new MongoClient(mongoUrl);
                  var database = client.GetDatabase(mongoUrl.DatabaseName);
                  var collection = database.GetCollection<BsonDocument>("Users");
                  var list = await collection.Find(new BsonDocument("Name", "Jack"))
                      .ToListAsync();
                  foreach (var document in list)
                  {
                      Console.WriteLine(document["Name"]);
                  }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            top2tch@outlook.com Richard Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: