[SERVER-50823] MongoDB Does not consider maxSessions Created: 09/Sep/20  Updated: 27/Oct/23  Resolved: 21/Sep/20

Status: Closed
Project: Core Server
Component/s: Stability
Affects Version/s: 4.0.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: vikrant raghuvanshi Assignee: Dmitry Agranat
Resolution: Community Answered Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:
  1. Set the parameter maxSession 2 million.
  2. Restart the nodes.
  3. Increase the logical sessions count over 1 Million.
  4. After hitting the threshold the queries will return "cannot add session into the cache". With TooManyLogicalSessions.
Participants:

 Description   

MongoDb Community version 4.0.5 does not seems to consider settings for maxSession

Tried setting a different count then the default but it still gives error after the default active session count is reached.

The only way to avoid that is to restart the whole cluster(or the replica nodes where the error is coming from).

 

Cluster Setup:

  • Router:
    • 3 with 8GB RAM and 4 core CPU each.
  • Configuration:
    • 3 with 8GB RAM and 4 core CPU each.
  • Arbiter:
    • 3 with 8GB RAM and 4 core CPU each.
  • Data Nodes:
    • 3 with 16 GB RAM and 4 core CPU each.

And we do not have any db/collection in sharding.



 Comments   
Comment by Dmitry Agranat [ 15/Sep/20 ]

Thanks vikscool97@gmail.com for all the additional details, we really appreciate this.

Comment by vikrant raghuvanshi [ 14/Sep/20 ]

Sure,
We had a increase in workload (by 200%) which ended up utilizing more RAM by the mongod instance and as a result the OS killed the process (but was brought back up by restart service). This kept on happening a couple of time after which we started seeing the message reporting "failed to register to session cache" error.
Which after sometime resulted in the above scenario. 

Comment by Dmitry Agranat [ 14/Sep/20 ]

Thanks for the update vikscool97@gmail.com, could you please clarify about the "improper shutdown of nodes"? Was it a power shutdown or anything else?

Comment by vikrant raghuvanshi [ 14/Sep/20 ]

Hi Dima,

Apologies for the delay.

Thanks for the suggestion of checking the system.sessions.
It turns out most of the data - nodes does not have that collection(as there was an improper shutdown of nodes) and as soon as we re-initiate the replica set.
We got the active session count working and the collection (system.session) was available in all the nodes.
So, you can close this issue.

And again thanks for all the quick help.

Comment by Dmitry Agranat [ 10/Sep/20 ]

Hi vikscool97@gmail.com,

In order for us to investigate this issue, we'll need to gather some information. Please provide the following:

  • Archive (tar or zip) the mongod.log files and the $dbpath/diagnostic.data directory (the contents are described here) and upload them to this support uploader location. Files uploaded to this portal are visible only to MongoDB employees and are routinely deleted after some time.
  • Does the config.system.sessions collection exist?

    use config
    show collections

  • Does the config.system.sessions collection have any documents?

    db.system.sessions.count()

  • What is the value of TTL index lsidTTLIndex on the system.sessions?

    use config
    db.system.sessions.getIndexes()

Also, could you please clarify the reported issue:

  • Is it that the custom maxSession threshold is not being respected?
  • Or is it hitting the TooManyLogicalSessions issue when the maxSession threshold is being respected?

Thanks,
Dima

Generated at Thu Feb 08 05:23:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.