[CSHARP-2652] C# API timeout on logical cache refresh Created: 26/Jun/19  Updated: 02/Jul/20  Resolved: 02/Jul/20

Status: Closed
Project: C# Driver
Component/s: API
Affects Version/s: 2.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Krati Singh Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In Mongo logs there are intermittent entries below. During same time it is observed that the C# APIs accessing data from MongoDB timeout with 504 error. Please suggest the root cause of this problem and probable solution. Sharing sample log lines below:

I WRITE    [LogicalSessionCacheRefresh] update config.system.sessions command: { q: { _id:

{ id: UUID("0c9936f3-8cbd-4518-ab7e-93a4c68138c7"), uid: BinData(0, 3B408CB48548B5037822C10EB0976B3CBF2CEE3BF9C708796BF03941FBECD80F) }

}, u: { $currentDate:

{ lastUse: true }

, $setOnInsert: { user:

{ name: "admin@admin" }

} }, multi: false, upsert: true } planSummary: IDHACK keysExamined:0 docsExamined:0 nMatched:0 nModified:0 upsert:1 keysInserted:2 numYields:1 locks:{ Global: { acquireCount:

{ r: 2, w: 2 }

}, Database: { acquireCount:

{ w: 2 }

}, Collection: { acquireCount:

{ w: 2 }

} } 10497ms

I COMMAND  [LogicalSessionCacheRefresh] command config.$cmd command: update { update: "system.sessions", ordered: false, allowImplicitCollectionCreation: false, writeConcern:

{ w: "majority", wtimeout: 15000 }

, $db: "config" } numYields:0 reslen:97965 locks:{ Global: { acquireCount:

{ r: 1002, w: 1002 }

}, Database: { acquireCount:

{ w: 1002 }

}, Collection: { acquireCount:

{ w: 1002 }

} } protocol:op_msg 10576ms



 Comments   
Comment by Esha Bhargava [ 02/Jul/20 ]

krati Apologies for the delay in responding to this request. This sounds like a support issue, so I wanted to give you some resources to get this questioned answered more quickly:

  • our MongoDB support portal, located at support.mongodb.com
  • our MongoDB community portal, located here
  • If you are an Atlas customer, there is free support offered 24/7 in the lower right hand corner of the UI.
    Just in case you have already opened a support case and are not receiving sufficient help, please let me know and I can facilitate escalating your issue.
    Thank you!
Comment by Krati Singh [ 23/Jul/19 ]

Hello Team,

Please share if there is any update on the issue?

Regards

Krati

Comment by Krati Singh [ 22/Jul/19 ]

This intermittent error in APIs is causing application UI to show error too:   
           500 Error while serving the API request, please try again: [Title'': 'Exception has occurred','Message':"'Command aggregrate failed:cannot add session into cache']

Comment by Krati Singh [ 22/Jul/19 ]

Sharing the responses below. Please help suggest the root cause of the problem and probable solution. Thank you!!
 
•MongoDB server version – 4.0
 
•MongoDB .NET/C# driver version – 2.5
 
•Stack trace error of the application from the driver:
"Exception":"Command findAndModify failed: cannot add session into the cache.", "StackTrace":"   at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.ProcessReply(ConnectionId connectionId, ReplyMessage`1 reply)\r\n   at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.Execute(IConnection connection, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocol[TResult](IWireProtocol`1 protocol, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Servers.Server.ServerChannel.Command[TResult](ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IElementNameValidator commandValidator, BsonDocument additionalOptions, Func`1 responseHandling, Boolean slaveOk, IBsonSerializer`1 resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Operations.CommandOperationBase`1.ExecuteProtocol(IChannelHandle channel, ICoreSessionHandle session, ReadPreference readPreference, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Operations.CommandOperationBase`1.ExecuteProtocol(IChannelSource channelSource, ICoreSessionHandle session, ReadPreference readPreference, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Operations.WriteCommandOperation`1.Execute(IWriteBinding binding, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Operations.FindAndModifyOperationBase`1.ExecuteAttempt(RetryableWriteContext context, Int32 attempt, Nullable`1 transactionNumber, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Operations.RetryableWriteOperationExecutor.Execute[TResult](IRetryableWriteOperation`1 operation, RetryableWriteContext context, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Operations.RetryableWriteOperationExecutor.Execute[TResult](IRetryableWriteOperation`1 operation, IWriteBinding binding, Boolean retryRequested, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.Core.Operations.FindAndModifyOperationBase`1.Execute(IWriteBinding binding, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.OperationExecutor.ExecuteWriteOperation[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteWriteOperation[TResult](IClientSessionHandle session, IWriteOperation`1 operation, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.MongoCollectionImpl`1.FindOneAndUpdate[TProjection](IClientSessionHandle session, FilterDefinition`1 filter, UpdateDefinition`1 update, FindOneAndUpdateOptions`2 options, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.MongoCollectionImpl`1.\u003c\u003ec_DisplayClass47_0`1.\u003cFindOneAndUpdate\u003eb_0(IClientSessionHandle session)\r\n   at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)\r\n   at MongoDB.Driver.MongoCollectionImpl`1.FindOneAndUpdate[TProjection](FilterDefinition`1 filter, UpdateDefinition`1 update, FindOneAndUpdateOptions`2 options, CancellationToken cancellationToken)\r\n

Generated at Wed Feb 07 21:43:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.