warning: cannot open /etc/hosts.deny: Too many open files

Asked by Mohan on 2013-03-09

The logs always shows up with these warning after 5 minutes of using the server

I checked the ulimit is defined correctly system wide

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 13559
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

I have also checked the open files using this command
pidof mosquitto | xargs lsof -a -p | wc -l which comes out to be 1038, this is below the system wide number of open file a user can open configured 4096

here's system specs

Linux xxxx 3.2.0-30-virtual #48-Ubuntu SMP Fri Aug 24 17:34:24 UTC 2012 i686 i686 i386 GNU/Linux

Package: mosquitto
Status: install ok installed
Priority: optional
Section: net
Installed-Size: 294
Maintainer: Roger A. Light <email address hidden>
Architecture: i386
Version: 1.1.3-0ppa2
Depends: libc6 (>= 2.4), libssl1.0.0 (>= 1.0.0), libwrap0 (>= 7.6-4~), upstart-job, adduser (>= 3.10), lsb-base (>= 3.2-13)
 /etc/init/mosquitto.conf 7ae5ef3f236e62489570cd51ae32fca8
 /etc/mosquitto/mosquitto.conf fd7985b372c42cedaa8dee63000a2179
 /etc/mosquitto/conf.d/README b4ac621550824082a735732bfb42b51d
 /etc/mosquitto/ca_certificates/README c1c6ae67f2def06c6a483be09b49d4de
 /etc/mosquitto/certs/README 4d8a70d4cefab07d4dabc5be1f786c1f
Description: MQTT version 3.1 compatible message broker
 This is a message broker that supports version 3.1 of the MQ Telemetry
 Transport protocol.
 MQTT provides a method of carrying out messaging using a publish/subscribe
 model. It is lightweight, both in terms of bandwidth usage and ease of
 implementation. This makes it particularly useful at the edge of the network
 where a sensor or other simple device may be implemented using an arduino for
Homepage: http://mosquitto.org/

Thank you in advance!


Question information

English Edit question
mosquitto Edit question
No assignee Edit question
Solved by:
Roger Light
Last query:
Last reply:
Best Roger Light (roger.light) said : #1

The system wide limit doesn't get applied because upstart sets the limits. Try editing /etc/init/mosquitto.conf and adding this line:

limit nofile 4096 4096

Mohan (lfsystemslogs) said : #2

Thanks Roger Light, that solved my question.