Closed techcom2 closed 8 months ago
Hi! @techcom2 can you get some more information? like: some memory issue, clients still connected after broker stop to print ?? I trying to reproduce the issue but I can't now. The clients are desktop software or some esp device?
Hello, 2 customers -0 is PC MQTT Explorer (receiving only) -1 is ESP8266 sending packet every 10s I added in the main loop: `unsigned long currentTime = millis();
if (currentTime - previousTime >= eventInterval) { Serial.println(ESP.getFreeHeap()); previousTime = currentTime; }` eventInterval = 10s.
@techcom2 hi!, there is available new version of this library, can you test the issue again please? in this case, enable core debug level to verbose, and let me see the outputs, I tested the broker for some days with no error: 2 costommers:
I can confirm that current master version of this lib is leaking memory as shows in the above picture. I have 5 clients each reporting every 1 sec. I can confirm by using them or just one PC client that on every message being published the broker leaks memory. I can also confirm the issue is not in the function where the broker finds all subscriptions and forwards them to the clients.
I can also confirm that. In my tests 15 clients connect, each sending one message per second. After about 2000 messages it stops responding.
Adding a free(publishMessage)
after calling notifyPublishReceivedCallback
in https://github.com/alexCajas/EmbeddedMqttBroker/blob/70c596b8f756a3d6fec768feaf59c415a6008f30/src/MqttClient/MqttClient.cpp#L76 seems to make a difference. Now I am up to 4000 messages in. Did anyone else find another memory leak?
ok thanks for you support guys. @cavefire when you send 4000 messages does the broker freeze or work fine?
fixed in v1.0.7-qos0.
Example simpleMqttBroker.ino sketch Two clients broadcast every 20 seconds, hangs after a few hours of work.
17:17:30.581 -> publishing: 1234/stan 17:17:30.581 -> enviando publish 17:17:39.364 -> sending ping response packet 17:17:45.727 -> publishing: 1234/stan 17:17:45.727 -> enviando publish 17:18:01.748 -> deleting client 17:18:04.958 -> deleting client 17:22:51.416 -> new client 17:22:51.416 -> 2 17:22:51.416 -> # 17:22:59.981 -> new client 17:22:59.981 -> 3 17:23:45.044 -> new client 17:23:45.044 -> 4 17:23:51.613 -> sending ping response packet 17:24:30.122 -> new client 17:24:30.122 -> 5 17:24:51.605 -> sending ping response packet 17:25:51.636 -> sending ping response packet 17:26:52.606 -> deleting client