[SERVER-49390] TooManyLogicalSessions: Cannot add session into the cache (error code 261) on standalone MongoDB Created: 09/Jul/20 Updated: 27/Oct/23 Resolved: 28/Jul/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | 4.0.19 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Joydip Datta | Assignee: | Dmitry Agranat |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Operating System: | ALL | ||||
| Participants: | |||||
| Description |
|
I am getting the same error in a mongodb setup (single replicaset; no sharding)
MongoDB version is 4.0.19
Following are excerpts from mongod log
Any help would be useful. The cluster is down and this is affecting our workloads. Also, is there a way to reopen this JIRA or should I open a new one? When we monitor number of sessions on MongoDB we see it is always increasing. Command to monitor sessions.
This was observed in two separate single replicaset unsharded setup. Example RS status:
|
| Comments |
| Comment by Dmitry Agranat [ 28/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We haven’t heard back from you for some time, so I’m going to mark this ticket as resolved. If this is still an issue for you, please provide additional information and we will reopen the ticket. Regards, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dmitry Agranat [ 20/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This misconfiguration only impact the config.system.sessions collection and as a result logical sessions lifecycle. Could you clarify what was the reason you have this configuration in your replica set in the first place? Thanks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joydip Datta [ 20/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Our use case was a single replicaset without sharding. We had two mongods to form a replset. But as you pointed, our mongod.conf file had this entry
We have now removed this config param and looks like issue is resolved now. We ran the same repro script (noted above) over 2 days and verified that TooManyLogicalSessions issue did not reproduce.
Can you please check, if this is a misconfiguration, then how our replset setup was otherwise running fine?
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dmitry Agranat [ 19/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
jdatta@imanisdata.com another thing that we'd like to understand is where this misconfiguration originates from. This would help us to review and adjust our current instructions/documentation which might have caused this. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joydip Datta [ 17/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks I will check this and get back to you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dmitry Agranat [ 16/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The reason you hit this issue is because the config.system.sessions collection does not exist. The sessions purging is done via TTL index on this collection. The root cause for this issue is your configuration which currently include:
In addition, MongoDB has detected this mis-configuration and reported here:
Please fix your configuration and report back with new results. Thanks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joydip Datta [ 13/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dmitry Agranat [ 12/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks jdatta@imanisdata.com for the repro, one last question, can you check that the config.system.sessions collection exist? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joydip Datta [ 10/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We could reproduce this with a simple script that opens a lot of MongoDB sessions and runs a find query in a tight loop. We ran 5 such scripts in parallel.
In a separate script, we monitored the number of sessions in the MongoDB server using the following script. This script prints the number of sessions every 2 mins.
From the output of the monitoring script, we can clearly see the number of sessions keeps on increasing beyond control. There was no other load against the server at that time. After a while server starts throwing error: TooManyLogicalSessions.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joydip Datta [ 10/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Drivers: mongo-java-driver 3.12.1
mongodb-driver-async 3.12.1
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joydip Datta [ 10/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have uploaded the requested files. Please check. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dmitry Agranat [ 09/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Would you please 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. Also, please note what driver type/version you use. Thanks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joydip Datta [ 09/Jul/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This could be similar to: https://jira.mongodb.org/browse/SERVER-39044 |