Closed tmdesigned closed 3 years ago
Hi @tmdesigned
Could you please make sure, you're not passing a NULL
pointer to the API? (one oversight on the mqtt client side is that it doesn't check for nullptr for these public APIs -- will fix!). This is a very generic use-case and it seems unlikely that something got broker here.
From the above coredump
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
...
...
EXCVADDR: 0x000000e5 ...
The LoadProhibited
error indicates a failure in reading from an invalid address, which in this case equals to offsetof(struct esp_mqtt_client, api_lock) == 0x0e5
, so the client is trying to lock the API using xSemaphoreTakeRecursive()
accessing 0x05, which means, very likely, the API was called with
esp_mqtt_client_enqueue(client = NULL, ...);
Thanks @david-cermak. You are correct, the mistake is on my end. The client was indeed not being passed in correctly (not visible in my simplified example above) and was therefore not accessible.
In a simple application, the
MQTT_API_LOCK(client);
call in theesp_mqtt_client_publish
andesp_mqtt_client_enqueue
functions causes the following core panic for my ESP32 device:This is from a simple application, the relevant lines of which are:
This occurred in my testing of both the stable release of esp-idf, as well as the master branch. In some cases, as this causes a reboot of the ESP32, the cycle of boot -> connect -> send -> crash repeats indefinitely. If I wait to send a message until the
MQTT_EVENT_SUBSCRIBED
event has been received back, then it crashes ~3 times before establishing itself and not crashing again (the non-simplified code uses a task to re-send the test message every 5 seconds).