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

System.AggregateException: An exception occurred while opening a connection to the server.

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.3
    • Connectivity
    • Mongodb 3.0.6 running on localhost, Win 7 ultimate 64bit

    Description

      I am running a lot of operations in parallel which are trying to access the database. I get this error on one of the UpdateOneAsync() operations(this is not always the same, I get this exception on other functions as well).

      System.AggregateException:

      {"An exception occurred while opening a connection to the server."}

      StackTrace:

      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 Data.MongoContext.Update[T](String collectionName, Expression`1 filter, Dictionary`2 fieldsToUpdate) in C:\...Data\MongoContext.cs:line 163
      ..

      The InnerException has more info:

      ConnectionId: {{ ServerId :

      { ClusterId : 1, EndPoint : "Unspecified/localhost:27017" }

      , LocalValue : 163 }}

      InnerException:

      {"Timed out connecting to Unspecified/localhost:27017. Timeout was 00:00:30."}

      Message: An exception occurred while opening a connection to the server.

      Source: MongoDB.Driver.Core

      StackTrace: at MongoDB.Driver.Core.Connections.BinaryConnection.<OpenHelperAsync>d__48.MoveNext()
      — 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.Core.Servers.Server.<GetChannelAsync>d__27.MoveNext()
      — 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.Core.Operations.BulkMixedWriteOperation.<ExecuteAsync>d__39.MoveNext()
      — 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.OperationExecutor.<ExecuteWriteOperationAsync>d__3`1.MoveNext()
      — 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.<ExecuteWriteOperationAsync>d__61`1.MoveNext()
      — 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.<BulkWriteAsync>d__22.MoveNext()
      — 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.MongoCollectionBase`1.<UpdateOneAsync>d__43.MoveNext()

      I have tried changing the connectionpoolsize, waitqueuemultiple, waitqueuesize, maxidletimems and also making the MongoContext as a static variable. All that does not seem to help. I even tried to downgrade to 2.2 and 2.1 versions of the driver and also upgraded it to 2.4 but nothing seems to fix that issue.

      Attachments

        Activity

          People

            Unassigned Unassigned
            thakursagar Sagar Thakur
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: