<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MQTT apply for messaging is causing out of memory]]></title><description><![CDATA[<p dir="auto">I am have a a Basic Core device and I'm trying to build an integration with HomeAssistant, i have a number of sensors and relays connected to the M5. I have the device reading and publishing all the sensors to HA, however i have two relays i want to be able to trigger from HA, I have created the MQTT subscriptions however the moment i add "MQTT apply for messaging" to Loop, I my code initially works, then i start to see "mqtt_client: Error create mqtt task" errors every 15 seconds (I have nothing set on a 15 sec timer)), and after some time i get "mqtt_client: esp_mqtt_set_config(415): Memory exhausted" and the system panics and needs a power cycle before it will start working again</p>
<p dir="auto">The moment i remove "MQTT apply for messaging" i no longer have this issue....</p>
<p dir="auto">Not sure what to do, i even tried to build a safe function that would tear down MQTT and reconnect, but whatever i do, i still run out of memory eventually</p>
<p dir="auto"><img src="/assets/uploads/files/1753494527582-475e36f5-5e38-4c5e-a5b9-77e55ccee34b-image.png" alt="475e36f5-5e38-4c5e-a5b9-77e55ccee34b-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/topic/7712/mqtt-apply-for-messaging-is-causing-out-of-memory</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 23:22:08 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7712.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 Jul 2025 01:53:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MQTT apply for messaging is causing out of memory on Wed, 30 Jul 2025 01:27:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/oracle_sod" aria-label="Profile: oracle_sod">@<bdi>oracle_sod</bdi></a> I recently discovered this problem too, when the device sends multiple reconnections to the server, a memory leak will occur. This problem has existed for a long time.</p>
]]></description><link>https://community.m5stack.com/post/29650</link><guid isPermaLink="true">https://community.m5stack.com/post/29650</guid><dc:creator><![CDATA[lbuque]]></dc:creator><pubDate>Wed, 30 Jul 2025 01:27:16 GMT</pubDate></item><item><title><![CDATA[Reply to MQTT apply for messaging is causing out of memory on Wed, 30 Jul 2025 01:25:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/oracle_sod" aria-label="Profile: oracle_sod">@<bdi>oracle_sod</bdi></a> I had planned to add HA to uiflow2, but I didn't have the time to implement it. Here's a library I wrote if you're using MicroPython.<a href="https://github.com/lbuque/micropython-home-assistant" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/lbuque/micropython-home-assistant</a></p>
]]></description><link>https://community.m5stack.com/post/29649</link><guid isPermaLink="true">https://community.m5stack.com/post/29649</guid><dc:creator><![CDATA[lbuque]]></dc:creator><pubDate>Wed, 30 Jul 2025 01:25:53 GMT</pubDate></item><item><title><![CDATA[Reply to MQTT apply for messaging is causing out of memory on Tue, 29 Jul 2025 17:10:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a> I did notice the device trying to connect out to the uiflow URL using MQTT, is there a way to disable this ? I have a feeling there are memory leaks in the uiflow code and i don't need any of that (happy to connect via usb to update)...  Or is there a way to get support from M5stack on this ?</p>
]]></description><link>https://community.m5stack.com/post/29647</link><guid isPermaLink="true">https://community.m5stack.com/post/29647</guid><dc:creator><![CDATA[oracle_sod]]></dc:creator><pubDate>Tue, 29 Jul 2025 17:10:25 GMT</pubDate></item><item><title><![CDATA[Reply to MQTT apply for messaging is causing out of memory on Mon, 28 Jul 2025 05:41:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/oracle_sod" aria-label="Profile: oracle_sod">@<bdi>oracle_sod</bdi></a> I think this may be connected to an error I found.<br />
set up a basic "Hello world" example and check the terminal. I was getting MQTT server errors with basic code because M5Stack are using MQTT for pushing programs from the UIFLow server to the cores.</p>
]]></description><link>https://community.m5stack.com/post/29628</link><guid isPermaLink="true">https://community.m5stack.com/post/29628</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Mon, 28 Jul 2025 05:41:53 GMT</pubDate></item><item><title><![CDATA[Reply to MQTT apply for messaging is causing out of memory on Mon, 28 Jul 2025 01:03:11 GMT]]></title><description><![CDATA[<p dir="auto">Ok after some more work, i have decided to modify the project and manually code it rather than using the GUI, so no more nested str concats etc and no more massive list of global variables.</p>
<p dir="auto">After all that work, im still getting "mqtt_client: Error create mqtt task" errors every 15 seconds</p>
<p dir="auto">Using gc.mem_free(), i have confirmed i never have less than 60k of memory free, i have also confirmed that no MQTT publish exceeds 400 bytes</p>
<p dir="auto">I do have quite a few items published (16) however I have grouped them so its only 5 calls to update them all. and i have 2 subscriptions</p>
<p dir="auto">I have spent 2 days digging at this and I cant find any reason for the  "mqtt_client: Error create mqtt task" errors or the eventual "esp_mqtt_set_config(415): Memory exhausted" even though right before this message i had my own logging return that i still have 70k of memory (and i had run a gc.collect()</p>
<p dir="auto">I'm updating my sensors once every 60 seconds, yet even when these are not updating I still get the  "mqtt_client: Error create mqtt task" which means something else is running and using mqtt, none of my code is, im not sure how to troubleshoot this further.</p>
<p dir="auto">I'm avoiding having to switch to C++ and Arduino as I tried that but had issues with the i2c connectivity and timing so i would really like to get this working in the M5 stack micro python, any assistance would be much appreciated</p>
]]></description><link>https://community.m5stack.com/post/29626</link><guid isPermaLink="true">https://community.m5stack.com/post/29626</guid><dc:creator><![CDATA[oracle_sod]]></dc:creator><pubDate>Mon, 28 Jul 2025 01:03:11 GMT</pubDate></item></channel></rss>