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

Unobserved task exception on connection failure raises its head again

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.13.0
    • Affects Version/s: 2.12.0
    • Component/s: Connectivity
    • Labels:
      None
    • Environment:
      Windows Server 2019 x64
      .NET Framework 4.8

      It seems that CSHARP-1628 is with us again. Since upgrading to 2.12.0 we occasionally receive the following exception in our unobserved exception logger:

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
       ---> MongoDB.Driver.MongoConnectionException: An exception occurred while receiving a message from the server.
      ResponseMessage MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveMessage(int responseTo, IMessageEncoderSelector encoderSelector, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
      ResponseMessage MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool+AcquiredConnection.ReceiveMessage(int responseTo, IMessageEncoderSelector encoderSelector, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
      TCommandResult MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol<TCommandResult>.Execute(IConnection connection, CancellationToken cancellationToken)
      TCommandResult MongoDB.Driver.Core.WireProtocol.CommandWireProtocol<TCommandResult>.Execute(IConnection connection, CancellationToken cancellationToken)
      TResult MongoDB.Driver.Core.Servers.Server+ServerChannel.ExecuteProtocol<TResult>(IWireProtocol<TResult> protocol, ICoreSession session, CancellationToken cancellationToken)
      TResult MongoDB.Driver.Core.Servers.Server+ServerChannel.Command<TResult>(ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IEnumerable<Type1CommandMessageSection> commandPayloads, IElementNameValidator commandValidator, BsonDocument additionalOptions, Action<IMessageEncoderPostProcessor> postWriteAction, CommandResponseHandling responseHandling, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
      TCommandResult MongoDB.Driver.Core.Operations.CommandOperationBase<TCommandResult>.ExecuteProtocol(IChannelHandle channel, ICoreSessionHandle session, ReadPreference readPreference, CancellationToken cancellationToken)
      TCommandResult MongoDB.Driver.Core.Operations.ReadCommandOperation<TCommandResult>.ExecuteAttempt(RetryableReadContext context, int attempt, long? transactionNumber, CancellationToken cancellationToken)
      TResult MongoDB.Driver.Core.Operations.RetryableReadOperationExecutor.Execute<TResult>(IRetryableReadOperation<TResult> operation, RetryableReadContext context, CancellationToken cancellationToken) ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
      int System.Net.Sockets.NetworkStream.Read(out byte[] buffer, int offset, int size)
      void MongoDB.Driver.Core.Misc.StreamExtensionMethods.ReadBytes(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken)
      IByteBuffer MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBuffer(CancellationToken cancellationToken) ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
      int System.Net.Sockets.NetworkStream.Read(out byte[] buffer, int offset, int size)
         --- End of inner exception stack trace ---
         --- End of inner exception stack trace ---
         --- End of inner exception stack trace --- ---> MongoDB.Driver.MongoConnectionException: An exception occurred while receiving a message from the server.
      ResponseMessage MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveMessage(int responseTo, IMessageEncoderSelector encoderSelector, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
      ResponseMessage MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool+AcquiredConnection.ReceiveMessage(int responseTo, IMessageEncoderSelector encoderSelector, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
      TCommandResult MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol<TCommandResult>.Execute(IConnection connection, CancellationToken cancellationToken)
      TCommandResult MongoDB.Driver.Core.WireProtocol.CommandWireProtocol<TCommandResult>.Execute(IConnection connection, CancellationToken cancellationToken)
      TResult MongoDB.Driver.Core.Servers.Server+ServerChannel.ExecuteProtocol<TResult>(IWireProtocol<TResult> protocol, ICoreSession session, CancellationToken cancellationToken)
      TResult MongoDB.Driver.Core.Servers.Server+ServerChannel.Command<TResult>(ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IEnumerable<Type1CommandMessageSection> commandPayloads, IElementNameValidator commandValidator, BsonDocument additionalOptions, Action<IMessageEncoderPostProcessor> postWriteAction, CommandResponseHandling responseHandling, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
      TCommandResult MongoDB.Driver.Core.Operations.CommandOperationBase<TCommandResult>.ExecuteProtocol(IChannelHandle channel, ICoreSessionHandle session, ReadPreference readPreference, CancellationToken cancellationToken)
      TCommandResult MongoDB.Driver.Core.Operations.ReadCommandOperation<TCommandResult>.ExecuteAttempt(RetryableReadContext context, int attempt, long? transactionNumber, CancellationToken cancellationToken)
      TResult MongoDB.Driver.Core.Operations.RetryableReadOperationExecutor.Execute<TResult>(IRetryableReadOperation<TResult> operation, RetryableReadContext context, CancellationToken cancellationToken) ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
      int System.Net.Sockets.NetworkStream.Read(out byte[] buffer, int offset, int size)
      void MongoDB.Driver.Core.Misc.StreamExtensionMethods.ReadBytes(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken)
      IByteBuffer MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBuffer(CancellationToken cancellationToken) ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
      int System.Net.Sockets.NetworkStream.Read(out byte[] buffer, int offset, int size)
         --- End of inner exception stack trace ---
         --- End of inner exception stack trace ---
         --- End of inner exception stack trace ---
      

      It's of low priority, but I still believe you might want to know about this.

            Assignee:
            mikalai.mazurenka@mongodb.com Mikalai Mazurenka (Inactive)
            Reporter:
            onyxmaster Aristarkh Zagorodnikov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: