[SERVER-4407] Log warnings on startup if (hard) rlimits are no good Created: 01/Dec/11  Updated: 03/Jun/19  Resolved: 17/May/12

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

Type: Improvement Priority: Minor - P4
Reporter: Richard Kreuter (Inactive) Assignee: Kevin Matulef
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-5864 Write script to test rlimit check Closed
is depended on by SERVER-41453 Raise the minimum file handle limit t... Closed
Related
related to SERVER-3776 Server unable to accept more than ~10... Closed
Participants:

 Description   

Some Linux distros have unusably low limits for things like number of processes or file descriptors. It would be handy if we checked the rlimits on startup and complained if the limits were too low for typical MongoDB uses.



 Comments   
Comment by Kevin Matulef [ 07/Mar/12 ]

I moved the rlimit check so that it happens in a much saner place, along with other checks that happen at startup. However, the check is currently only performed on certain platforms. I need to do some research to figure out how to perform the check on the other platforms (i.e. windows), so I'm leaving this ticket open for now, but will reschedule it for the next version.

Comment by auto [ 07/Mar/12 ]

Author:

{u'login': u'matulef', u'name': u'Kevin Matulef', u'email': u'matulef@gmail.com'}

Message: SERVER-4407 moved rlimit check to better place
Branch: master
https://github.com/mongodb/mongo/commit/f729d0c69bbaae99c38d56e8711c3ca9acb5c8c9

Comment by Richard Kreuter (Inactive) [ 09/Feb/12 ]

Please add a test for this. Something like

ulimit <something low>
mongod --logpath <path to log>
<check for startup warnings or something>

Comment by Richard Kreuter (Inactive) [ 09/Feb/12 ]

The rlimit warnings are being printed at the beginning of main(), before argument parsing and logpath setup, and so (a) they're cluttering up the --version output, and, more importantly (b) they won't end up in the user's log file. Cf.

$ ./mongod --logpath /tmp/log --fork
Thu Feb 9 17:20:52 Warning: soft rlimits too low. Number of files is 256, should be at least 1000
forked process: 10729
all output going to: /tmp/log
log file [/tmp/log] exists; copied to temporary file [/tmp/log.2012-02-09T22-20-52]
child process started successfully, parent exiting

Comment by auto [ 21/Dec/11 ]

Author:

{u'login': u'matulef', u'name': u'Kevin Matulef', u'email': u'matulef@gmail.com'}

Message: SERVER-4407 check rlimits on startup
Branch: master
https://github.com/mongodb/mongo/commit/2fa3f79aeb5185053541be4e1412bcf97399c6dc

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