[SERVER-6437] ERROR: mmap() failed for ... len: .... errno:12 Cannot allocate memory when inserting millions of record Created: 13/Jul/12  Updated: 15/Aug/12  Resolved: 13/Jul/12

Status: Closed
Project: Core Server
Component/s: Stability
Affects Version/s: 2.0.4, 2.0.6
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: José Manuel Ciges Regueiro Assignee: Unassigned
Resolution: Done Votes: 0
Labels: memory, mmap
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Suse Linux Enterprise Server 10 (Virtual Server on Xen)
RAM: 10 Gb and 5 Gb
Cores: 32 (AMD) and 16 (AMD)


Attachments: File breaks_Mongo.php    
Operating System: Linux
Participants:

 Description   

When making massive inserts it reaches a point where the server rejects new inserts with the following error in the logs:

ERROR: mmap() failed for ...
len: .... errno:12 Cannot allocate memory

We have tested making it in PHP and Python, and the problem is the same in both.

The attachment is a simple script in PHP which causes the error

We have apparently solver it telling the kernel not to limit the memory size of the MongoDB project with the command

sysctl -v unlimited



 Comments   
Comment by José Manuel Ciges Regueiro [ 16/Jul/12 ]

Thanks, Andy for your answer.

Do you know if the solution adopted by us, setting ulimit -v unlimited for the session which starts the server, is OK?

The command is ulimit -v unlimited (and no sysctl, as I have told by error in the issue description)

Comment by Andy Schwerin [ 13/Jul/12 ]

By design, mongod processes map all database data files into their address space, and so will consume a large amount of virtual memory. This does not necessarily correspond to a large physical RAM footprint, as only recently and frequently accessed data need to be kept in physical memory.

Generated at Thu Feb 08 03:11:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.