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

Ignore PlatformNotSupportedException when configuring KeepAlive

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 2.7.2
    • Affects Version/s: 2.7.1
    • Component/s: Connectivity
    • Labels:
      None
    • Environment:
      Azure web app for containers - linux docker image.

      After upgrading to the latest C# driver 2.7.1, the dotnet core 2.1 web application using the mongo driver and running on Azure Web apps for containers (linux docker image), cannot start up any more. I am getting the exception below:

      2018-11-09T10:30:58.459115820Z Application startup exception: System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/xdb.1.xxx.com:27017" }", EndPoint: "Unspecified/xdb.1.xxx.com:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.PlatformNotSupportedException: Socket.IOControl handles Windows-specific control codes and is not supported on this platform.
      2018-11-09T10:30:58.459144120Z    at System.Net.Sockets.SocketPal.WindowsIoctl(SafeCloseSocket handle, Int32 ioControlCode, Byte[] optionInValue, Byte[] optionOutValue, Int32& optionLength)
      2018-11-09T10:30:58.459148920Z    at System.Net.Sockets.Socket.IOControl(Int32 ioControlCode, Byte[] optionInValue, Byte[] optionOutValue)
      2018-11-09T10:30:58.459152821Z    at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateSocket(EndPoint endPoint)
      2018-11-09T10:30:58.459156621Z    at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
      2018-11-09T10:30:58.459160521Z    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
      2018-11-09T10:30:58.459172721Z    --- End of inner exception stack trace ---
      2018-11-09T10:30:58.459176421Z    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
      2018-11-09T10:30:58.459180921Z    at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)" }, { ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/xdb.2.xxx.com:27017" }", EndPoint: "Unspecified/xdb.2.xxx.com:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.PlatformNotSupportedException: Socket.IOControl handles Windows-specific control codes and is not supported on this platform.
      2018-11-09T10:30:58.459185621Z    at System.Net.Sockets.SocketPal.WindowsIoctl(SafeCloseSocket handle, Int32 ioControlCode, Byte[] optionInValue, Byte[] optionOutValue, Int32& optionLength)
      2018-11-09T10:30:58.459189321Z    at System.Net.Sockets.Socket.IOControl(Int32 ioControlCode, Byte[] optionInValue, Byte[] optionOutValue)
      2018-11-09T10:30:58.459192721Z    at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateSocket(EndPoint endPoint)
      2018-11-09T10:30:58.459196121Z    at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
      2018-11-09T10:30:58.459199621Z    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
      2018-11-09T10:30:58.459203021Z    --- End of inner exception stack trace ---
      2018-11-09T10:30:58.459206421Z    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
      2018-11-09T10:30:58.459209921Z    at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)" }] }.
      2018-11-09T10:30:58.459213321Z    at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
      2018-11-09T10:30:58.459216821Z    at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
      2018-11-09T10:30:58.459220221Z    at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
      2018-11-09T10:30:58.459224021Z    at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
      2018-11-09T10:30:58.459227421Z    at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)
      2018-11-09T10:30:58.459231621Z    at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)
      2018-11-09T10:30:58.459235021Z    at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)
      2018-11-09T10:30:58.459238521Z    at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
      2018-11-09T10:30:58.459242221Z    at MongoDB.Driver.MongoCollectionImpl`1.FindSync[TProjection](FilterDefinition`1 filter, FindOptions`2 options, CancellationToken cancellationToken)
      2018-11-09T10:30:58.459248621Z    at MongoDB.Driver.FilteredMongoCollectionBase`1.FindSync[TProjection](FilterDefinition`1 filter, FindOptions`2 options, CancellationToken cancellationToken)
      2018-11-09T10:30:58.459252321Z    at MongoDB.Driver.FindFluent`2.ToCursor(CancellationToken cancellationToken)
      2018-11-09T10:30:58.459255721Z    at MongoDB.Driver.IAsyncCursorSourceExtensions.ToList[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)
      

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            provanguard Marek Kotolowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: