[SERVER-28934] Mongo systemd service does not define nofiles Created: 24/Apr/17  Updated: 27/Oct/23  Resolved: 01/May/17

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

Type: Bug Priority: Minor - P4
Reporter: Uri Harduf Assignee: Mark Agarunov
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-26438 systemd rejects service file in debia... Closed
Operating System: Linux
Participants:

 Description   

The issue started after installing the latest mongo server, where the service of mongo has changed from mongod to mongodb, and the service was installed via /usr/lib/systemd and not under /etc/init.

The problem is that the systemd service does not use the limits defined in /etc/security/limits.conf, and mongo starts with 1024 max open files, and easily crashes as it runs out of open files.

Also generally systemd does not check /etc/security/limits.conf and you need to add LimitNOFILES to the service.



 Comments   
Comment by Mark Agarunov [ 01/May/17 ]

Hello uri.harduf,

Thank you for providing this information. The behavior you are seeing is expected in environments running systemd. When systemd is used, as it is on Ubuntu 16.04, the open file limit is set by the LimitNOFILES directive in the mongod.service file, located at /lib/systemd/system/mongod.service on Ubuntu 16.04. By default, this is set to:

LimitNOFILE=64000

But can be increased if needed.

Thanks,
Mark

Comment by Uri Harduf [ 30/Apr/17 ]
  • Operating system - Ubuntu 16.04-02 LTS
  • Mongo was installed using apt-get after installing the mongo repository (http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse)
  • Mongo version is 3.4.3
Comment by Mark Agarunov [ 26/Apr/17 ]

Hello uri.harduf,

Thank you for the report. We are investigating the behavior you've described, however I have a couple questions to help clarify this issue.

  • Which operating system, distribution, and version is this instance of MongoDB running on?
  • How was MongoDB installed on this system? (Package manager, downloaded from website, built from source, etc.)
  • Which version of MongoDB is being used?

Thanks,
Mark

Generated at Thu Feb 08 04:19:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.