mqtt_delete_request() method has no protection against queue loops. I didn’t figure out how loops are created during putting requests into the queue, but breaking such loops fix was trivial and eliminated the problem
/**
* Delete request item
* @param r Request item to delete
*/
static void
mqtt_delete_request(struct mqtt_request_t *r)
{
if (r != NULL) {
// Break potential loops
if (r->next != r) {
r->next = r;
}
else {
r->next = NULL;
}
}
}