[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) |
||
| Attachments: |
|
| 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 ... 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. |