[SERVER-49684] Mlock error at mongo console opening - failed to mlock: Cannot allocate locked memory. Created: 17/Jul/20  Updated: 27/Oct/23  Resolved: 21/Jul/20

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

Type: Bug Priority: Major - P3
Reporter: Vincent Liagre 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
Participants:

 Description   

I have just tried to install MongoDB on a fresh Ubuntu 18 machine.

For this I went through the tutorial from the website: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition-using-deb-packages

Everything went fine - including starting the server with 

sudo systemctl start mongod 

and checking that it runs with:

sudo systemctl status mongod

Only I can't seem to start a mongo console. When I type mongo, I get the following error:

 

2020-07-17T13:26:48.049+0000 F - [main] Failed to mlock: Cannot allocate locked memory. For more details see: https://dochub.mongodb.org/core/cannot-allocate-locked-memory: Operation not permitted
2020-07-17T13:26:48.049+0000 F - [main] Fatal Assertion 28832 at src/mongo/base/secure_allocator.cpp 255
2020-07-17T13:26:48.049+0000 F - [main]
***aborting after fassert() failure

I checked for the suggested link but there seems to be no limitation problem as resources are not limited (as per check with ulimit). Machine has 16Gb RAM. Any idea what the problem/solution might be?

 

 

 



 Comments   
Comment by Dmitry Agranat [ 21/Jul/20 ]

Hi liagre.vincent@gmail.com,

The SERVER project is for bugs and feature suggestions for the MongoDB server. This sounds like a configuration issue related ulimit setting. As this ticket does not appear to be a bug, I will now close it. If you need further assistance troubleshooting, I encourage you to ask our community by posting on the MongoDB Community Forums or on Stack Overflow with the mongodb tag.

Regards,
Dima

Comment by Vincent Liagre [ 20/Jul/20 ]

Hi Dmitry,

Thank you for getting back to me. I am a bit confused.

1) What do you mean here: "could you please post the requested output together with the executed command of cat /proc/$pid/limits?" ? It's precisely what I did in my previous post, or I am missing something...

2) "would you please archive (tar or zip) the mongod.log files" ; I have no clue where to find those ; could you help me with this?

3) "and the $dbpath/diagnostic.data directory" : same problem here.

Thank you for all the help,

Best,

Vincent

Comment by Dmitry Agranat [ 20/Jul/20 ]

Hi liagre.vincent@gmail.com, could you please post the requested output together with the executed command of cat /proc/$pid/limits?

Also, 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.

Thanks,
Dima

Comment by Vincent Liagre [ 20/Jul/20 ]

Hello Dmitry,

 

Thank you for getting back to me on this. The limits are:

Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 64000 64000 processes
Max open files 64000 64000 files
Max locked memory unlimited unlimited bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 62761 62761 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us

Comment by Dmitry Agranat [ 19/Jul/20 ]

Hi liagre.vincent@gmail.com,

Could you please provide the output for mongod process limits?

cat /proc/$pid/limits

Where pid is the process id of mongod

Thanks,
Dima

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