2

I used mosquitto as MQTT broker, and it seems if connection number is more than 1000, the below log printed. Anybody know something about this?

1470896904: Client connection from 111.7.170.177 denied access by tcpd.

Chris Feng
  • 189
  • 5
  • 19

3 Answers3

4

I feel your process(mosquitto) have hit the maximum number of open file descriptors limit. Check your max open files by ulimit -n. Then increase the limit to max number of connections expected by you. E.g. For 10k connection it would be ulimit -n 10000

A note on ulimit(1). It is only set for the current terminal and for persistent changes you will need to edit config files as per your Linux flavor( /etc/security/limits.conf + /etc/pam.d/common-session* on Ubuntu ).

Community
  • 1
  • 1
kiranpradeep
  • 10,859
  • 4
  • 50
  • 82
  • The max open files number is 1000000, much larger than connection number. – Chris Feng Oct 13 '16 at 01:52
  • @FengChris Check the user account with which mosquitto is run. Is it logged in user or user in mosquitto.conf ? Then check limit for that user. – kiranpradeep Oct 13 '16 at 08:44
  • 1
    I used supervisor to start mosquitto and the max open files limited to 1024 by supervisor as default. Add `minfds=1000000` in `/etc/supervisor/supervisord.conf` can resolve this problem. – Chris Feng Nov 22 '16 at 17:35
  • I am facing the same trouble, but this answer not solve my issue. Do you know any other change I can do to solve the problem? I am using mosquitto 1.6.3 on ubuntu 14. thanks in advance – pedro.olimpio Mar 07 '20 at 23:33
0

There might be another reason for this error message. The same message wil be displayed in the log if a client tries to connect and access is denied by TCPD. You need to adjust hosts.allow (in my case for localhost 127.0.0.1) to connect.

  • This is really a comment, not an answer as it may not be the issue at all (doesn't sound like it). With a bit more rep, [you will be able to post comments](//stackoverflow.com/privileges/comment). – Marc Jan 04 '18 at 14:23
0

I had similar problem using Ubuntu 14 with mosquitto 1.6.3 and I solved my issue making these changes:

Open the: /etc/init/mosquitto.conf file

Add limit nofile 4096 4096 before exec;

4096 indicate the number of clients

service mosquitto stop service mosquitto start

I hope help another people that have the same issue.

pedro.olimpio
  • 1,478
  • 2
  • 22
  • 43