eclipse-mosquitto / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
9.08k stars 2.4k forks source link

No memory limit of mosquitto client queue #2153

Open gennartan opened 3 years ago

gennartan commented 3 years ago

Whenever a new message is being published from the client by mosquitto_publish() , it is appened to a linked list containing all the messages to be sent. But it is not being processed right after that. Mosquitto loop will check the message to be sent and send the necessary messages.

The problem is that there is no limit to the number of message that we can add in this linked list. If the number of incoming message is higher than the network abilities of the computer, the program will quickly run out of memory and be killed by the computer.

This problem does only occurs for mosquitto client, and not mosquitto broker. For the broker, there is this specific line of code that solves a lot of things:

#if defined(WITH_MEMORY_TRACKING) && defined(WITH_BROKER) && defined(__GLIBC__)
#define REAL_WITH_MEMORY_TRACKING
#endif
CodyPannell commented 10 months ago

Has there been any progress on this issue?