使用插座开发包,面板控制开关会内存泄漏

Zigbee 子设备开发


xiaot
Posts: 18

使用电工插座开发包demo,配网后面板控制开关,设备端打印heapsize在处理开关响应后不会释放内存,导致内存泄漏

xiaot
Posts: 18

Re: 使用插座开发包,面板控制开关会内存泄漏

[14:46:26.352]
[14:46:26.362] [0761755586 TUYA D][app_main.c:540] app gen msg cb: cluster 0x702, cmd 0,heapsze =2612
[14:46:26.372]
[14:46:27.917] [0761755587 TUYA D][app_main.c:540] app gen msg cb: cluster 0x00, cmd 0,heapsze =2612
[14:46:27.923]
[14:46:32.691] [0761755592 TUYA D][app_main.c:724] app spec msg cb: cluster 0x06, cmd 0x00
[14:46:32.692]
[14:46:32.697] [0761755592 TUYA D][app_main.c:728] receive single message
[14:46:32.730] [0761755592 TUYA D][tbl_onoff_function_module.c:193] on off status 0
[14:46:32.733]
[14:46:34.074] [0761755593 TUYA D][app_main.c:540] app gen msg cb: cluster 0x00, cmd 0,heapsze =2528
[14:46:34.082]
[14:46:34.358] [0761755594 TUYA D][app_main.c:724] app spec msg cb: cluster 0x06, cmd 0x00
[14:46:34.362]
[14:46:34.362] [0761755594 TUYA D][app_main.c:728] receive single message
[14:46:34.615] [0761755594 TUYA D][tbl_onoff_function_module.c:193] on off status 0
[14:46:34.622]
[14:46:35.939] [0761755595 TUYA D][app_main.c:724] app spec msg cb: cluster 0x06, cmd 0x00
[14:46:35.942]
[14:46:35.942] [0761755595 TUYA D][app_main.c:728] receive single message
[14:46:35.969] [0761755595 TUYA D][tbl_onoff_function_module.c:193] on off status 0
[14:46:35.972]
[14:46:39.187] [0761755598 TUYA D][app_main.c:540] app gen msg cb: cluster 0x00, cmd 0,heapsze =2360
[14:46:39.192]
[14:46:44.316] [0761755604 TUYA D][app_main.c:540] app gen msg cb: cluster 0x00, cmd 0,heapsze =2360
[14:46:44.322]
[14:46:49.447] [0761755609 TUYA D][app_main.c:540] app gen msg cb: cluster 0x00, cmd 0,heapsze =2360
[14:46:49.452]
[14:46:54.555] [0761755614 TUYA D][app_main.c:540] app gen msg cb: cluster 0x00, cmd 0,heapsze =2360
[14:46:54.563]
[14:46:59.685] [0761755619 TUYA D][app_main.c:540] app gen msg cb: cluster 0x00, cmd 0,heapsze =2360

huanghuan
Posts: 244

Re: 使用插座开发包,面板控制开关会内存泄漏

你好,请补充下,开发框架及版本,具体的产品开发包版本也请补充下方便我们定位问题

xiaot
Posts: 18

Re: 使用插座开发包,面板控制开关会内存泄漏

TLSR8258_TuyaOS-3.8.0,开发包demo:tuyaos_demo_meter_socket_tl;
再此基础上增加到4路开关注册,以及修改了IO,关闭了计量部分,开关响应部分处理无改动

xiaot
Posts: 18

Re: 使用插座开发包,面板控制开关会内存泄漏

请问有定位到该问题吗 这边测试这个问题是必现的

huanghuan
Posts: 244

Re: 使用插座开发包,面板控制开关会内存泄漏

1.我们复现了这个问题,这个问题是在发送队列满来不及发送的情况下会触发,一般只会在急速控制下出现,我们会再下个版本修复。
2.当前你可以先规避这个问题:将delay_time 改为0;同时在 tal_zg_send_data前调用 tal_zg_clear_send_data(ZG_CLEAR_ALL_ZCL_ID, &send_data.zcl_id); 清除残留的没有发送的相同指令数据。
3.注意每个report内容不一样的情况下 send_data.zcl_id需要彼此不一样,比如 ATTR_ON_OFF_ATTRIBUTE_ID是100,另外的attr id需要是101等

Code: Select all

VOID_T tbl_report_onoff_attribute_value(UINT8_T endpoint, BOOL_T onoff, TAL_SEND_QOS_E qos)
{
    TAL_ZG_SEND_DATA_T send_data;
    TAL_PR_DEBUG("on off status %d\r\n", onoff);

tal_system_memset(&send_data, 0, sizeof(TAL_ZG_SEND_DATA_T));

send_data.delay_time = 0;
send_data.random_time = 0;
send_data.zcl_id = 100;
send_data.qos = qos;
send_data.direction = ZG_ZCL_DATA_SERVER_TO_CLIENT;
send_data.frame_type = ZG_ZCL_FRAME_TYPE_GLOBAL;
send_data.command_id = CMD_REPORT_ATTRIBUTES_COMMAND_ID;

// unicast to gateway
send_data.addr.mode = SEND_MODE_DEV;
send_data.addr.type.dev.dst_addr = TUYA_GATEWAY_ADDRESS;
send_data.addr.type.dev.dst_ep = 0x01;
send_data.addr.type.dev.src_ep = endpoint;
send_data.addr.type.dev.cluster_id = CLUSTER_ON_OFF_CLUSTER_ID;

send_data.data.zg.attr_sum = 1;
send_data.data.zg.attr[0].attr_id = ATTR_ON_OFF_ATTRIBUTE_ID;
send_data.data.zg.attr[0].type = ATTR_BOOLEAN_ATTRIBUTE_TYPE;
send_data.data.zg.attr[0].size = 1;
send_data.data.zg.attr[0].value[0] = onoff;
tal_zg_clear_send_data(ZG_CLEAR_ALL_ZCL_ID, &send_data.zcl_id);
tal_zg_send_data(&send_data, NULL, 1000);
}
xiaot
Posts: 18

Re: 使用插座开发包,面板控制开关会内存泄漏

感谢!!! :D

xiaot
Posts: 18

Re: 使用插座开发包,面板控制开关会内存泄漏

还有个问题请教一下,首次配上网后,面板可控,上下行正常;设备断电在上电显示power_on_online---,但是这个时候再去控制面板开关,有收到下发指令,没有上报成功(也没有触发上报回调SEND_RESULT_CB),这会是哪里有问题

Code: Select all

send_data.delay_time = 0;
send_data.random_time = 0;
send_data.zcl_id = 100;//endpoint
send_data.qos = qos;
send_data.direction = ZG_ZCL_DATA_SERVER_TO_CLIENT;
send_data.frame_type = ZG_ZCL_FRAME_TYPE_GLOBAL;
send_data.command_id = CMD_REPORT_ATTRIBUTES_COMMAND_ID;

// unicast to gateway
send_data.addr.mode = SEND_MODE_DEV;
send_data.addr.type.dev.dst_addr = TUYA_GATEWAY_ADDRESS;
send_data.addr.type.dev.dst_ep = 0x01;
send_data.addr.type.dev.src_ep = endpoint;
send_data.addr.type.dev.cluster_id = CLUSTER_ON_OFF_CLUSTER_ID;

send_data.data.zg.attr_sum = 1;
send_data.data.zg.attr[0].attr_id = ATTR_ON_OFF_ATTRIBUTE_ID;
send_data.data.zg.attr[0].type = ATTR_BOOLEAN_ATTRIBUTE_TYPE;
send_data.data.zg.attr[0].size = 1;
send_data.data.zg.attr[0].value[0] = onoff;
tal_zg_clear_send_data(ZG_CLEAR_ALL_ZCL_ID, &send_data.zcl_id);
tal_zg_send_data(&send_data, SEND_RESULT_CB, 1000);
huanghuan
Posts: 244

Re: 使用插座开发包,面板控制开关会内存泄漏

1.你好,上述问题的原因是重启后load report table的时间不对,导致设备需要被配置report table才能进行上报
2.如果你不需要report table你可以将 tal_zg_reporting_init(g_report_config, table_size); 这个相关函数删除
3.在3.8.0版本,如果你需要report table你需要将 tal_zg_reporting_init(g_report_config, table_size); 相关函数放在 last init中
4.我们在 3.9.0版本修复了这个report table配置函数时序的限制问题,你可以申请使用3.9.0版本,该版本是向前兼容 3.8.0版本固件的

xiaot
Posts: 18

Re: 使用插座开发包,面板控制开关会内存泄漏

好的,谢谢

Post Reply