Hello,
I am trying to create and connect 1024 Mosquitto clients using Mosquitto API libmosquitto inside a c file (For a test).
I wrote a basic test c file, where I have a 1024 iterations loop which, for each itearation, creates a Mosquitto client calling mosquitto_new function, then connects it calling mosquitto_connect and mosquitto_loop_start functions.
From the 341th created element, I get a “Lookup error” (inside the connect callback) after calling mosquitto_connect function.
I am using a 64 bits Red Hat Enterprise Linux 8.6.
I tried the following solutions :
1) I checked the system limitations, and tried to increase the open files limitations to 16384 :
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 30912
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 16384
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) 30912
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
When I increase the open files limitations, I can connect all my 1024 elements but I have still issues from the 341th, seems there is no dialog with the broker, the clients from 341th get disconnected by the broker after 60 seconds timeout.
Howerver no problem for the first 340 first elements.
2) I tried to use 2 loops with 1024 iteations each, on for creation, another for connection and loop start.
In that case, I can create all my 1024 elements but then I cannot even connect the first one.
3) I tried to create 2 binary files, which create and connect 256 clients each. This works, the server accepts the 512 connections. But for my test I need to create and connect the clients from the same binary file.
I compiled both broker and API from sources. The broker, and the binary file which creates and connects clients both run on the same local machine.
The broker doesn’t seem to have limitations. Seems there is another unknown limitation somewhere then prevents my binary file to create and connect more than 340 clients.
Is there another system limitation, or maybe a limitation in the api itself that could prevent more than 340 clients to be generated and connected from the same binary file?
Thank you in advance for your help.