mdf_mem message buffer problem

XiotSamuel
Posts: 53
Joined: Sun Aug 29, 2021 1:50 pm

mdf_mem message buffer problem

Postby XiotSamuel » Thu Dec 16, 2021 3:18 am

Hi. I am using the light example with some additional function like additional mlink handler, mqtt client and sensor component to test the esp32, but when I try to send multiple http message to the http server in a very short interval around 30 to 40 times I found some buffer in the mcommon is full and display following error message. I trace to the code in the mcommon as attached below. Do I need to handle it or the mcommon API can clean the memory up automatically?

The root node have send out MDF_OK every time as attached.

Code: Select all

I (778518) [mesh_utils, 156]: Child mac: 4c:75:25:cc:77:98
E (778556) [mdf_mem, 45]: The buffer space of the memory record is full
I (778557) [mdf_mem, 122]: (446) <iot_light: 392> ptr: 0x3ff80c78, size: 514
I (778569) [mdf_mem, 122]: (448) <iot_light: 399> ptr: 0x3ff818e4, size: 176
I (778570) [mdf_mem, 122]: (811) <mdebug_log: 191> ptr: 0x3ffd4844, size: 9
I (778581) [mdf_mem, 122]: (815) <mdebug_espnow: 110> ptr: 0x3ffd7408, size: 238
I (778592) [mdf_mem, 122]: (751041) <mdebug_espnow: 82> ptr: 0x3ffb5c20, size: 239
I (778593) [mdf_mem, 122]: (50276) <mlink_handle: 79> ptr: 0x3ffb865c, size: 108
I (778604) [mdf_mem, 122]: (456374) <mwifi: 1000> ptr: 0x3fff0530, size: 1456
I (778615) [mdf_mem, 122]: (143981) <mlink_httpd: 937> ptr: 0x3ffb320c, size: 80
I (778616) [mdf_mem, 122]: (143985) <mlink_notice: 169> ptr: 0x3ffdc6b8, size: 64
I (778627) [mdf_mem, 122]: (50277) <mlink_handle: 172> ptr: 0x3ffb86cc, size: 864
I (778639) [mdf_mem, 122]: (50277) <mlink_trigger: 421> ptr: 0x3ffb8a30, size: 88
I (778641) [mdf_mem, 122]: (50279) <mlink_espnow: 76> ptr: 0x3ffb0684, size: 1000
I (778653) [mdf_mem, 122]: (50280) <mwifi: 301> ptr: 0x3ffb97f8, size: 32
I (778664) [mdf_mem, 122]: (50280) <mwifi: 306> ptr: 0x3ffb981c, size: 176
I (778665) [mdf_mem, 122]: (778556) <mwifi: 1373> ptr: 0x3fff26e4, size: 39
I (778676) [mdf_mem, 122]: (147333) <mlink_httpd: 346> ptr: 0x3ffb36d8, size: 24
I (778687) [mdf_mem, 122]: (147334) <mlink_httpd: 410> ptr: 0x3ffb3730, size: 29
I (778688) [mdf_mem, 122]: (147334) <mlink_httpd: 386> ptr: 0x3ffb352c, size: 6
I (778699) [mdf_mem, 122]: (160687) <mlink_httpd: 346> ptr: 0x3ffdc09c, size: 24
I (778711) [mdf_mem, 122]: (160688) <mlink_httpd: 410> ptr: 0x3ffdbcb4, size: 29
I (778712) [mdf_mem, 122]: (160688) <mlink_httpd: 386> ptr: 0x3ffb36f8, size: 6
I (778723) [mdf_mem, 122]: (170698) <mlink_httpd: 346> ptr: 0x3ffde2f4, size: 24
I (778734) [mdf_mem, 122]: (170699) <mlink_httpd: 410> ptr: 0x3ffdbcd8, size: 29
I (778745) [mdf_mem, 122]: (170699) <mlink_httpd: 386> ptr: 0x3ffde270, size: 13
I (778747) [mdf_mem, 122]: (260812) <mlink_httpd: 346> ptr: 0x3ffde250, size: 24
I (778758) [mdf_mem, 122]: (260813) <mlink_httpd: 410> ptr: 0x3ffdbcfc, size: 29
I (778769) [mdf_mem, 122]: (260812) <mlink_httpd: 386> ptr: 0x3ffdc088, size: 13
I (778770) [mdf_mem, 122]: (455947) <mlink_httpd: 346> ptr: 0x3ffde3fc, size: 24
I (778781) [mdf_mem, 122]: (455949) <mlink_httpd: 410> ptr: 0x3ffde418, size: 29
I (778792) [mdf_mem, 122]: (455948) <mlink_httpd: 386> ptr: 0x3ffde310, size: 13
I (778793) [mdf_mem, 122]: (472829) <mlink_httpd: 346> ptr: 0x3ffde4b8, size: 24
I (778805) [mdf_mem, 122]: (472830) <mlink_httpd: 410> ptr: 0x3ffdbba0, size: 198
I (778816) [mdf_mem, 122]: (472830) <mlink_httpd: 386> ptr: 0x3ffde4d4, size: 6
I (778817) [mdf_mem, 122]: (485542) <mlink_httpd: 346> ptr: 0x3ffde4e4, size: 24
I (778828) [mdf_mem, 122]: (485543) <mlink_httpd: 410> ptr: 0x3ffefa28, size: 198
I (778839) [mdf_mem, 122]: (485542) <mlink_httpd: 386> ptr: 0x3ffde500, size: 6
I (778842) [mdf_mem, 122]: (494911) <mlink_httpd: 346> ptr: 0x3ffb6190, size: 24
I (778853) [mdf_mem, 122]: (494912) <mlink_httpd: 410> ptr: 0x3ffdbddc, size: 198
I (778864) [mdf_mem, 122]: (494911) <mlink_httpd: 386> ptr: 0x3ffb2f04, size: 6
I (778865) [mdf_mem, 122]: (495335) <mlink_httpd: 346> ptr: 0x3ffb2f14, size: 24
I (778876) [mdf_mem, 122]: (495336) <mlink_httpd: 410> ptr: 0x3fff02c4, size: 198
I (778888) [mdf_mem, 122]: (495335) <mlink_httpd: 386> ptr: 0x3ffb2f30, size: 6
I (778899) [mdf_mem, 122]: (495827) <mlink_httpd: 346> ptr: 0x3ffb2f40, size: 24
I (778900) [mdf_mem, 122]: (495828) <mlink_httpd: 410> ptr: 0x3fff0390, size: 198
I (778911) [mdf_mem, 122]: (495828) <mlink_httpd: 386> ptr: 0x3ffb2f5c, size: 6
I (778922) [mdf_mem, 122]: (496399) <mlink_httpd: 346> ptr: 0x3ffb6174, size: 24
I (778923) [mdf_mem, 122]: (496400) <mlink_httpd: 410> ptr: 0x3fff045c, size: 198
I (778934) [mdf_mem, 122]: (496399) <mlink_httpd: 386> ptr: 0x3ffde49c, size: 6
I (778946) [mdf_mem, 122]: (496927) <mlink_httpd: 346> ptr: 0x3ffdb954, size: 24
I (778948) [mdf_mem, 122]: (496928) <mlink_httpd: 410> ptr: 0x3ffed0c4, size: 198
I (778959) [mdf_mem, 122]: (496927) <mlink_httpd: 386> ptr: 0x3ffdb970, size: 6
I (778970) [mdf_mem, 122]: (497366) <mlink_httpd: 346> ptr: 0x3ffefb54, size: 24
I (778971) [mdf_mem, 122]: (497367) <mlink_httpd: 410> ptr: 0x3ffed190, size: 198
I (778982) [mdf_mem, 122]: (497366) <mlink_httpd: 386> ptr: 0x3ffefb70, size: 6
I (778993) [mdf_mem, 122]: (497819) <mlink_httpd: 346> ptr: 0x3ffefb80, size: 24
I (778994) [mdf_mem, 122]: (497820) <mlink_httpd: 410> ptr: 0x3ffed25c, size: 198
I (779005) [mdf_mem, 122]: (497819) <mlink_httpd: 386> ptr: 0x3ffefb9c, size: 6
I (779017) [mdf_mem, 122]: (498337) <mlink_httpd: 346> ptr: 0x3fff0ae4, size: 24
I (779028) [mdf_mem, 122]: (498338) <mlink_httpd: 410> ptr: 0x3fff0b00, size: 198
I (779029) [mdf_mem, 122]: (498338) <mlink_httpd: 386> ptr: 0x3ffefbac, size: 6
I (779041) [mdf_mem, 122]: (498895) <mlink_httpd: 346> ptr: 0x3fff0bcc, size: 24
I (779052) [mdf_mem, 122]: (498896) <mlink_httpd: 410> ptr: 0x3ffed328, size: 198
I (779054) [mdf_mem, 122]: (498896) <mlink_httpd: 386> ptr: 0x3fff0be8, size: 6
I (779065) [mdf_mem, 122]: (698206) <mlink_httpd: 346> ptr: 0x3ffdbc6c, size: 24
I (779076) [mdf_mem, 122]: (698207) <mlink_httpd: 410> ptr: 0x3ffdba54, size: 198
I (779077) [mdf_mem, 122]: (698207) <mlink_httpd: 386> ptr: 0x3ffdb9bc, size: 6
I (779088) [mdf_mem, 122]: (698626) <mlink_httpd: 346> ptr: 0x3ffdbc88, size: 24
I (779099) [mdf_mem, 122]: (698627) <mlink_httpd: 410> ptr: 0x3fff0bfc, size: 198
I (779100) [mdf_mem, 122]: (698626) <mlink_httpd: 386> ptr: 0x3ffdbca4, size: 6
I (779111) [mdf_mem, 122]: (699078) <mlink_httpd: 346> ptr: 0x3ffde384, size: 24
I (779123) [mdf_mem, 122]: (699079) <mlink_httpd: 410> ptr: 0x3ffed3f4, size: 198
I (779124) [mdf_mem, 122]: (699078) <mlink_httpd: 386> ptr: 0x3ffde3a0, size: 6
I (779135) [mdf_mem, 122]: (699554) <mlink_httpd: 346> ptr: 0x3ffde3b0, size: 24
I (779146) [mdf_mem, 122]: (699555) <mlink_httpd: 410> ptr: 0x3ffed4c0, size: 198
I (779157) [mdf_mem, 122]: (699555) <mlink_httpd: 386> ptr: 0x3ffde3cc, size: 6
I (779159) [mdf_mem, 122]: (699979) <mlink_httpd: 346> ptr: 0x3ffde3dc, size: 24
I (779170) [mdf_mem, 122]: (699980) <mlink_httpd: 410> ptr: 0x3fff0cc8, size: 198
I (779181) [mdf_mem, 122]: (699980) <mlink_httpd: 386> ptr: 0x3ffed58c, size: 6
I (779182) [mdf_mem, 122]: (700328) <mlink_httpd: 346> ptr: 0x3fff01d4, size: 24
I (779193) [mdf_mem, 122]: (700329) <mlink_httpd: 410> ptr: 0x3fff1438, size: 198
I (779204) [mdf_mem, 122]: (700328) <mlink_httpd: 386> ptr: 0x3fff01f0, size: 6
I (779205) [mdf_mem, 122]: (701740) <mlink_httpd: 346> ptr: 0x3fff0200, size: 24

Code: Select all

void mdf_mem_print_record(void)
{
    size_t total_size = 0;

    if (!MDF_MEM_DEBUG) {
        MDF_LOGE("Please enable memory record");
    }

    if (!g_mem_count || !g_mem_info) {
        MDF_LOGE("Memory record is empty");
        return ;
    }

    if (!g_mem_info_lock) {
        g_mem_info_lock = xSemaphoreCreateMutex();
    }

    xSemaphoreTake(g_mem_info_lock, portMAX_DELAY);

    for (int i = 0; i < MDF_MEM_DBG_INFO_MAX; i++) {
        if (g_mem_info[i].size) {
            MDF_LOGI("(%d) <%s: %d> ptr: %p, size: %d", g_mem_info[i].timestamp, g_mem_info[i].tag, g_mem_info[i].line,
                     g_mem_info[i].ptr, g_mem_info[i].size);
            total_size += g_mem_info[i].size;
        }
    }

    xSemaphoreGive(g_mem_info_lock);

    MDF_LOGI("Memory record, num: %d, size: %zu", g_mem_count, total_size);
}

Code: Select all

D (91329) [Example, 147]: Root send, addrs_num: 1, addrs_list: 4c:75:25:cc:77:98, size: 198, data: {
    "request": "set_status",
    "characteristics": [
        {
            "cid": 7,
            "value": 100
        },
        {
            "cid": 4,
            "value": 100
        }
    ]
}
W (91363) [mqtt_driver, 481]: <MDF_ERR_INVALID_STATE> MQTT client has not started
D (91409) [Example, 89]: Root receive, addr: 4c:75:25:cc:77:98, size: 39, data: {"status_msg":"MDF_OK","status_code":0}

Who is online

Users browsing this forum: No registered users and 64 guests