esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

MQTT-IDF fails to initialise (memory exhausted) #5774

Open wifwucite opened 4 months ago

wifwucite commented 4 months ago

The problem

A configuration file that used to work with an older version of ESPHome (2022.6.3) now fails to initialise the MQTT client. From the logs it seems that some memory is exhausted, even though there should be plenty of memory.

Which version of ESPHome has the issue?

2024.4.2

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

N/A

What platform are you using?

ESP32

Board

heltec_wifi_kit_32_v2 (8MB flash)

Component causing the issue

mqtt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

[20:42:11][C][mqtt:037]: Setting up MQTT...
[20:42:11][W][component:157]: Component mqtt set Warning flag: unspecified
[20:42:11][I][mqtt:234]: Connecting to MQTT...
[20:42:11][D][esp-idf:000]: E (9006) MQTT_CLIENT: esp_mqtt_client_init(795): Memory exhausted
[20:42:11]
[20:42:11][E][mqtt.idf:103]: Failed to initialize IDF-MQTT
[20:42:11][W][component:170]: Component wifi cleared Warning flag
[20:42:11][D][sntp:080]: Synchronized time: 2024-05-08 20:42:11
09:50:52][C][mqtt:037]: Setting up MQTT...
[09:50:52][W][component:157]: Component mqtt set Warning flag: unspecified
[09:50:52][I][mqtt:234]: Connecting to MQTT...
[09:50:52][D][esp-idf:000]: E (9947) esp-tls: couldn't get hostname for :192.168.178.40: getaddrinfo() returns 203, addrinfo=0x0
[09:50:52]
[09:50:52][D][esp-idf:000]: E (20418) TRANSPORT_BASE: Failed to open a new connection: 32769
[09:50:52]
[09:50:52][D][esp-idf:000]: E (20419) MQTT_CLIENT: Error transport connect
[09:50:52]
[09:50:52][D][esp-idf:000]: E (20642) MDNS: Cannot allocate memory (line: 4591, free heap: 200 bytes)
[09:50:52]
[09:50:53]
[09:50:53]abort() was called at PC 0x4021bb23 on core 1

Additional information

Looking at the compile output there should be plenty of memory: Compiling .pioenvs/co2-sensor/src/main.cpp.o Linking .pioenvs/co2-sensor/firmware.elf RAM: [== ] 18.1% (used 59280 bytes from 327680 bytes) Flash: [===== ] 50.0% (used 1965853 bytes from 3932160 bytes) Building .pioenvs/co2-sensor/firmware.bin

However, I am using, the web server, BLE server (github://wifwucite/esphome-ble-controller) and MQTT. So some internal buffer seems to overrun. But with the Arduino framework based MQTT client, things used to work fine.

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.