Varun Kumar
Varun Kumar

Reputation: 322

Atlas MongoDB getting timeout occured after 30000ms when hosted ubuntu 16.04 LTS, using .Net mongodb driver

From local system .NET standard 2.0 with mongo driver 2.7.3 connecting to Atlas mongodb and listing change stream working.

When i deploy the same system on to ubuntu 16.04 LTS it is throwing below error.

Connection string:

mongodb://xxxxxx:xxxxx@mycluster-shard-00-00- 
xxxx.mongodb.net:27017,mycluster-shard-00-01- 
xxxx.mongodb.net:27017,mycluster-shard-00-02-xxxx.mongodb.net:27017/test?ssl=true& 
replicaSet=Cluster-shard-0&retryWrites=true

Error:

             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 : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/mycluster-shard-00-00-xxxx.mongodb.net:27017" }", EndPoint: "U
            nspecified/mycluster-shard-00-00-xxxx.mongodb.net:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.IO.IOException: Th
            e authentication or decryption has failed. ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.#012  at Mono.Security.Protocol.Tls.RecordProtocol.E
            ndReceiveRecord (System.IAsyncResult asyncResult) [0x00037] in <081f2539f5f74de086ddfa5e875c2fff>:0 #012  at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (System.IAsyncResult ar, System.Boolean ignoreEmpty) [0x00000] in <081f2539f5f74de086
            ddfa5e875c2fff>:0 #012  at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (System.IAsyncResult result) [0x00071] in <081f2539f5f74de086ddfa5e875c2fff>:0 #012   --- End of inner exception stack trace ---#012  at Mono.Security.Protocol.Tls.SslClient
            Stream.EndNegotiateHandshake (System.IAsyncResult result) [0x00032] in <081f2539f5f74de086ddfa5e875c2fff>:0 #012  at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (System.IAsyncResult asyncResult) [0x0000c] in <081f2539f5f74de086ddfa5e875c2
            fff>:0 #012   --- End of inner exception stack trace ---#012  at Mono.Security.Protocol.Tls.SslStreamBase.EndRead (System.IAsyncResult asyncResult) [0x0004b] in <081f2539f5f74de086ddfa5e875c2fff>:0 #012  at Mono.Net.Security.Private.LegacySslStream.EndAuthenticate
            AsClient (System.IAsyncResult asyncResult) [0x0000e] in <8ad536febd8d4466a395baa742076330>:0 #012  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endActio
            n, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <f5397d5e4dd146a1b2f33671be050366>:0 #012--- End of stack trace from previous location where exception was thrown ---#012  at System.Runtime.ExceptionService
            s.ExceptionDispatchInfo.Throw () [0x0000c] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runti
            me.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [
            0x00008] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at MongoDB.Driver.Core.Connections.SslStreamFactory+<Cre
            ateStreamAsync>d__4.MoveNext () [0x00182] in <50e51985348f46898d8a3c7759e943e8>:0 #012--- End of stack trace from previous location where exception was thrown ---#012  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f5397d5e4dd1
            46a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebugger
            Notification (System.Threading.Tasks.Task task) [0x00028] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at Syst
            em.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at MongoDB.Driver.Core.Connections.BinaryConnection+<OpenHelperAsync>d__48.MoveNext () [0x000b6] in <50e
            51985348f46898d8a3c7759e943e8>:0 #012   --- End of inner exception stack trace ---#012  at MongoDB.Driver.Core.Connections.BinaryConnection+<OpenHelperAsync>d__48.MoveNext () [0x001b4] in <50e51985348f46898d8a3c7759e943e8>:0 #012--- End of stack trace from previou
            s location where exception was thrown ---#012  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.T
            ask task) [0x0003e] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime
            .CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <f5397d5e4dd146a1b2f33671be050366>:0 #012  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+Config

Stack trace:

            at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException (MongoDB.Driver.Core.Clusters.ServerSelectors.IServerSelector selector, MongoDB.Driver.Core.Clusters.ClusterDescription description) [0x00013] in <50e51985348f46898d8a3
            c7759e943e8>:0 #012  at MongoDB.Driver.Core.Clusters.Cluster+WaitForDescriptionChangedHelper.HandleCompletedTask (System.Threading.Tasks.Task completedTask) [0x00009] in <50e51985348f46898d8a3c7759e943e8>:0 #012  at MongoDB.Driver.Core.Clusters.Cluster.WaitForD
            escriptionChanged (MongoDB.Driver.Core.Clusters.ServerSelectors.IServerSelector selector, MongoDB.Driver.Core.Clusters.ClusterDescription description, System.Threading.Tasks.Task descriptionChangedTask, System.TimeSpan timeout, System.Threading.Cancellati
            onToken cancellationToken) [0x00021] in <50e51985348f46898d8a3c7759e943e8>:0 #012  at MongoDB.Driver.Core.Clusters.Cluster.SelectServer (MongoDB.Driver.Core.Clusters.ServerSelectors.IServerSelector selector, System.Threading.CancellationToken cancellationTok
            en) [0x00057] in <50e51985348f46898d8a3c7759e943e8>:0 #012  at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection (System.Threading.CancellationToken cancellationToken) [0x00006] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012  at MongoDB.Driver.M
            ongoClient.AreSessionsSupported (System.Threading.CancellationToken cancellationToken) [0x0001b] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012  at MongoDB.Driver.MongoClient.StartImplicitSession (System.Threading.CancellationToken cancellationToken) [0x00000]
            in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012  at MongoDB.Driver.OperationExecutor.StartImplicitSession (System.Threading.CancellationToken cancellationToken) [0x00000] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012  at MongoDB.Driver.MongoCollectionImpl`1[TDocum
            ent].UsingImplicitSession[TResult] (System.Func`2[T,TResult] func, System.Threading.CancellationToken cancellationToken) [0x00000] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012  at MongoDB.Driver.MongoCollectionImpl`1[TDocument].Watch[TResult] (MongoDB.Driver
            .PipelineDefinition`2[TInput,TOutput] pipeline, MongoDB.Driver.ChangeStreamOptions options, System.Threading.CancellationToken cancellationToken) [0x0002f] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012  at StateDataStore.CloudControlRoomState.Listen () [0x001
            41] in <97005dd8325444bca5185303cdcf2ece>:0
            Warning: Failed to connect to the agentx master agent ([NIL]):
enter code here

any help!

Upvotes: 0

Views: 1071

Answers (1)

Varun Kumar
Varun Kumar

Reputation: 322

MongoDb Atlas freeware not supporting change streams, that's why we were faced this issue.

It's working fine when MongoDb installed in AWS EC2 instance, we are able to connect and listen change streams.

Upvotes: 2

Related Questions