Increasing Open File limit on mosquitto process - system wide changes show fine

836 views
Skip to first unread message

Lance Raymond

unread,
Jul 27, 2017, 10:28:57 AM7/27/17
to MQTT
I found a similar thread (https://groups.google.com/forum/#!searchin/mqtt/ubuntu$20open$20file$20limit%7Csort:relevance) with a similar issue, the items done I have done and tested with no change in results.   This is being tested on an AWS t2.small machine, Ubuntu 14.04LTS and the filesystem changes for the limits reflect fine;

ulimit -Hn
64000

ulimit -Sn
64000

/etc/sysctl.conf has the following;
fs.file-max = 10000000
fs.nr_open = 10000000

/etc/security/limits.conf has the following;
*     soft    nofile          64000
*     hard    nofile          64000
root     soft    nofile          64000
root     hard    nofile          64000

Both PAM files have been updated as well to allow the changes.    So here is the problem;

I have tried running the process as the default mosquitto user as well as root with the same results.  Ulimit (as shown above) is allowing the 64k file, but after 1k connections there failing and a check at the process level is the issue;

cat /proc/pid/limits shows;
Max open files            1024                 4096                 files

So, stuck on how to change the per process open file limit.  Thanks for any help/suggestions.


Roger Light

unread,
Jul 27, 2017, 12:01:23 PM7/27/17
to MQTT
Hi Lance,

Are you running it via upstart or manually? If by upstart, then you
need to add a line to /etc/init/mosquitto.conf e.g.:

limit nofile 16384 16384

Cheers,

Roger
> --
> To learn more about MQTT please visit http://mqtt.org
> ---
> You received this message because you are subscribed to the Google Groups
> "MQTT" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mqtt+uns...@googlegroups.com.
> To post to this group, send email to mq...@googlegroups.com.
> Visit this group at https://groups.google.com/group/mqtt.
> For more options, visit https://groups.google.com/d/optout.

Lance Raymond

unread,
Jul 27, 2017, 12:52:42 PM7/27/17
to mq...@googlegroups.com
Thanks, this is being done manually via sudo start mosquitto.

Just for a test, I added that to the conf and tried to start which syslog didn't like;

Jul 27 16:49:34 ip-192-168-1-231 kernel: [   62.702395] init: mosquitto main process (1560) terminated with status 3
Jul 27 16:49:34 ip-192-168-1-231 kernel: [   62.702402] init: mosquitto respawning too fast, stopped

So still stuck in my world of 1024.



Roger Light wrote:

limit nofile 16384 16384

Roger Light

unread,
Jul 27, 2017, 4:14:45 PM7/27/17
to MQTT
Hi Lance,

Make sure you put it in /etc/*init*/mosquitto.conf. It's not a mosquitto option.

Cheers,

Roger

Lance Raymond

unread,
Jul 27, 2017, 10:39:48 PM7/27/17
to mq...@googlegroups.com
*boom* ... worked perfect!

Thanks so much for such quick help and directions!

Cheers!

Yoga

unread,
Jun 26, 2020, 7:54:21 AM6/26/20
to MQTT

Yoga

unread,
Jun 26, 2020, 7:56:12 AM6/26/20
to MQTT
Hello All,

I am using AWS Linux, I have followed all your settings and config still it is showing the same.
Note: there is no "mosquito.conf", so I have created on /etc/init/mosqitto.conf

No luck...

Kind Regards,
Yoga

On Thursday, July 27, 2017 at 7:58:57 PM UTC+5:30, Lance Raymond wrote:
Reply all
Reply to author
Forward
0 new messages