Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blinker.attachRTData(rtData) 内核崩溃 #601

Open
Tonnp opened this issue May 14, 2023 · 2 comments
Open

Blinker.attachRTData(rtData) 内核崩溃 #601

Tonnp opened this issue May 14, 2023 · 2 comments

Comments

@Tonnp
Copy link

Tonnp commented May 14, 2023

== 提问请到论坛 https://www.arduino.cn/forum-132-1.html ==

基本信息

  • [] 这个问题满足提问指南
  • [] 我阅读了开发文档
  • [] 我使用了最新的库及APP进行测试,但是问题仍然存在
  • [] 我搜索过类似问题的解决方法但是仍然无法解决
  • [] 有设备端的LOG信息
  • [] 有编译报错信息
  • [] 我已填写基本信息

设备信息

  • 硬件: [Arduino by ESP32-WROOM]
  • 接入方式: [WIFI]
  • package版本: [esp32-v3.0-dev]
  • blinker库版本: [arduino v0.3.100221211]
  • 开发环境: [Arduino]
  • 操作系统: [Windows]

IDE 中的设置

  • Module: [Generic ESP8266 Module|Wemos D1 mini r2|Nodemcu|other]
  • Flash Mode: [qio|dio|other]
  • Flash Size: [4MB/1MB]
  • lwip Variant: [v1.4|v2 Lower Memory|Higher Bandwidth]
  • Reset Method: [ck|nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz|160MHz]
  • Upload Using: [OTA|SERIAL]
  • Upload Speed: [115200|other] (serial upload only)

手机信息及APP信息

  • 手机品牌及型号
  • android系统版本(请注意是android系统版本,不是厂商自己的版本号)
  • blinker App版本

问题描述

使用实时数据,并使用RTData,遇见3个问题
1、数据组件少时未出现与MQTT服务器断开的情况(大概6个组件),随着数量增加,发送提示断开的概率会随之增加(MQTT Disconnected)
2、提示断开后会再次尝试重发,发送数据会在原来的发送data外在增加一层data,变成了 {"data":{"data":{内容}发送类型等}发送类型等}
尝试使用 if(!STRING_contains_string(data,"data")){} 修复后没有2层data,但是还是会崩溃
3、随后就会出现内核崩溃
CORRUPT HEAP: Bad head at 0x3ffdb070. Expected 0xabba1234 got 0x00000000
abort() was called at PC 0x400871a1 on core 1

代码

setup里的代码
Blinker.begin(auth, ssid, pass);
// BLINKER_TAST_INIT(); //以为是线程导致的,屏蔽后依旧
Blinker.attachData(dataRead);
Blinker.attachHeartbeat(heartbeat);
Blinker.attachRTData(rtData);

void rtData()
{
Blinker.sendRtData("num-v1", ina1_voltage1000);
Blinker.sendRtData("num-v2", ina2_voltage
1000);
Blinker.sendRtData("num-v3", ina3_voltage1000);
Blinker.sendRtData("num-i1", ina1_converted
1000);
Blinker.sendRtData("num-i2", ina2_converted1000);
Blinker.sendRtData("num-i3", ina3_converted
1000);
Blinker.sendRtData("num-t1", isnan(t1_temperature)?0:t1_temperature);
Blinker.sendRtData("num-t2", isnan(t2_temperature)?0:t2_temperature);
Blinker.sendRtData("num-t3", isnan(t3_temperature)?0:t3_temperature);
Blinker.sendRtData("num-pwm1", ledcRead(pwmChannel_1));
Blinker.sendRtData("num-pwm2", ledcRead(pwmChannel_2));
Blinker.sendRtData("num-pwm3", ledcRead(pwmChannel_3));
Blinker.printRtData();
}

LOG信息

[22380] Got: {"fromDevice":"ee265a9ff0c911eda8eb5254","data":{"rt":["num-v1","num-i1","num-t1","num-pwm1","num-v2","num-t2","num-i2","num-pwm2","num-v3","num-t3","num-i3","num-pwm3"]}}
[22385] data: {"rt":["num-v1","num-i1","num-t1","num-pwm1","num-v2","num-t2","num-i2","num-pwm2","num-v3","num-t3","num-i3","num-pwm3"]}
[22397] fromDevice: ee265a9ff0c911eda8eb5254
[22401] Authority uuid
[22424] available: 1
[22424] checkAvail: 1
[22424] parse data: {"rt":["num-v1","num-i1","num-t1","num-pwm1","num-v2","num-t2","num-i2","num-pwm2","num-v3","num-t3","num-i3","num-pwm3"]}
[22429] defined BLINKER_ARDUINOJSON
[22433] autoManager begin: 0 0
[22435] containsKey rt
[22437] ===>rt get_key: num-v1
[22440] ===>rt get_key: num-i1
[22443] ===>rt get_key: num-t1
[22445] ===>rt get_key: num-pwm1
[22448] data_rtKeyCount: 4
[22451] ========data_rtRun
[22453] _fresh need flush
[22456] isParsed
[22457] flush
[23451] autoFormatData key: num-v1, json: "num-v1":{"date":1684025805,"val":0.00}
[23452] new.
[23452] autoFormatData key: num-v2, json: "num-v2":{"date":1684025805,"val":1.25}
[23456] add.
[23457] autoFormatData key: num-v3, json: "num-v3":{"date":1684025805,"val":0.00}
[23464] add.
[23466] autoFormatData key: num-i1, json: "num-i1":{"date":1684025805,"val":-0.50}
[23473] add.
[23474] autoFormatData key: num-i2, json: "num-i2":{"date":1684025805,"val":-0.50}
[23481] add.
[23483] autoFormatData key: num-i3, json: "num-i3":{"date":1684025805,"val":-0.20}
[23490] add.
[23491] autoFormatData key: num-t1, json: "num-t1":{"date":1684025805,"val":0.00}
[23498] add.
[23500] autoFormatData key: num-t2, json: "num-t2":{"date":1684025805,"val":0.00}
[23507] add.
[23508] autoFormatData key: num-t3, json: "num-t3":{"date":1684025805,"val":0.00}
[23515] add.
[23517] autoFormatData key: num-pwm1, json: "num-pwm1":{"date":1684025805,"val":204}
[23524] add.
[23525] autoFormatData key: num-pwm2, json: "num-pwm2":{"date":1684025805,"val":511}
[23532] add.
[23534] autoFormatData key: num-pwm3, json: "num-pwm3":{"date":1684025805,"val":818}
[23541] add.
[23542] print: {"num-v1":{"date":1684025805,"val":0.00},"num-v2":{"date":1684025805,"val":1.25},"num-v3":{"date":1684025805,"val":0.00},"num-i1":{"date":1684025805,"val":-0.50},"num-i2":{"date":1684025805,"val":-0.50},"num-i3":{"date":1684025805,"val":-0.20},"num-t1":{"date":1684025805,"val":0.00},"num-t2":{"date":1684025805,"val":0.00},"num-t3":{"date":1684025805,"val":0.00},"num-pwm1":{"date":1684025805,"val":204},"num-pwm2":{"date":1684025805,"val":511},"num-pwm3":{"date":1684025805,"val":818}}
[23586] Proto print...
[23588] Freeheap: 202368
[23591] isJson: {"data":{"num-v1":{"date":1684025805,"val":0.00},"num-v2":{"date":1684025805,"val":1.25},"num-v3":{"date":1684025805,"val":0.00},"num-i1":{"date":1684025805,"val":-0.50},"num-i2":{"date":1684025805,"val":-0.50},"num-i3":{"date":1684025805,"val":-0.20},"num-t1":{"date":1684025805,"val":0.00},"num-t2":{"date":1684025805,"val":0.00},"num-t3":{"date":1684025805,"val":0.00},"num-pwm1":{"date":1684025805,"val":204},"num-pwm2":{"date":1684025805,"val":511},"num-pwm3":{"date":1684025805,"val":818}},"fromDevice":"121FD9E6BOYWRPESH8PX5KZY","toDevice":"ee265a9ff0c911eda8eb5254","deviceType":"OwnApp"}
[23644] MQTT Publish...
[23646] Freeheap: 202368
[23651] {"data":{"num-v1":{"date":1684025805,"val":0.00},"num-v2":{"date":1684025805,"val":1.25},"num-v3":{"date":1684025805,"val":0.00},"num-i1":{"date":1684025805,"val":-0.50},"num-i2":{"date":1684025805,"val":-0.50},"num-i3":{"date":1684025805,"val":-0.20},"num-t1":{"date":1684025805,"val":0.00},"num-t2":{"date":1684025805,"val":0.00},"num-t3":{"date":1684025805,"val":0.00},"num-pwm1":{"date":1684025805,"val":204},"num-pwm2":{"date":1684025805,"val":511},"num-pwm3":{"date":1684025805,"val":818}},"fromDevice":"121FD9E6BOYWRPESH8PX5KZY","toDevice":"ee265a9ff0c911eda8eb5254","deviceType":"OwnApp"}
[23701] ...OK!
[23702] Freeheap: 198844
[23704] Freeheap: 199884
[24543] autoFormatData key: num-v1, json: "num-v1":{"date":1684025806,"val":0.00}
[24543] new.
[24544] autoFormatData key: num-v2, json: "num-v2":{"date":1684025806,"val":1.25}
[24547] add.
[24549] autoFormatData key: num-v3, json: "num-v3":{"date":1684025806,"val":0.00}
[24556] add.
[24557] autoFormatData key: num-i1, json: "num-i1":{"date":1684025806,"val":-0.20}
[24564] add.
[24566] autoFormatData key: num-i2, json: "num-i2":{"date":1684025806,"val":-0.20}
[24573] add.
[24574] autoFormatData key: num-i3, json: "num-i3":{"date":1684025806,"val":-0.50}

[24591] autoFormatData key: num-t2, json: "num-t2":{"date":1684025806,"val":0.00}
[24598] add.
[24600] autoFormatData key: num-t3, json: "num-t3":{"date":1684025806,"val":0.00}
[24607] add.
[24608] autoFormatData key: num-pwm1, json: "num-pwm1":{"date":1684025806,"val":204}
[24615] add.
[24617] autoFormatData key: num-pwm2, json: "num-pwm2":{"date":1684025806,"val":511}
[24624] add.
[24625] autoFormatData key: num-pwm3, json: "num-pwm3":{"date":1684025806,"val":818}
[24633] add.
[24634] print: {"num-v1":{"date":1684025806,"val":0.00},"num-v2":{"date":1684025806,"val":1.25},"num-v3":{"date":1684025806,"val":0.00},"num-i1":{"date":1684025806,"val":-0.20},"num-i2":{"date":1684025806,"val":-0.20},"num-i3":{"date":1684025806,"val":-0.50},"num-t1":{"date":1684025806,"val":0.00},"num-t2":{"date":1684025806,"val":0.00},"num-t3":{"date":1684025806,"val":0.00},"num-pwm1":{"date":1684025806,"val":204},"num-pwm2":{"date":1684025806,"val":511},"num-pwm3":{"date":1684025806,"val":818}}
[24678] Proto print...
[24680] Freeheap: 202200
[24682] isJson: {"data":{"num-v1":{"date":1684025806,"val":0.00},"num-v2":{"date":1684025806,"val":1.25},"num-v3":{"date":1684025806,"val":0.00},"num-i1":{"date":1684025806,"val":-0.20},"num-i2":{"date":1684025806,"val":-0.20},"num-i3":{"date":1684025806,"val":-0.50},"num-t1":{"date":1684025806,"val":0.00},"num-t2":{"date":1684025806,"val":0.00},"num-t3":{"date":1684025806,"val":0.00},"num-pwm1":{"date":1684025806,"val":204},"num-pwm2":{"date":1684025806,"val":511},"num-pwm3":{"date":1684025806,"val":818}},"fromDevice":"121FD9E6BOYWRPESH8PX5KZY","toDevice":"ee265a9ff0c911eda8eb5254","deviceType":"OwnApp"}
[24736] MQTT Publish...
[24737] Freeheap: 202200
[24743] {"data":{"num-v1":{"date":1684025806,"val":0.00},"num-v2":{"date":1684025806,"val":1.25},"num-v3":{"date":1684025806,"val":0.00},"num-i1":{"date":1684025806,"val":-0.20},"num-i2":{"date":1684025806,"val":-0.20},"num-i3":{"date":1684025806,"val":-0.50},"num-t1":{"date":1684025806,"val":0.00},"num-t2":{"date":1684025806,"val":0.00},"num-t3":{"date":1684025806,"val":0.00},"num-pwm1":{"date":1684025806,"val":204},"num-pwm2":{"date":1684025806,"val":511},"num-pwm3":{"date":1684025806,"val":818}},"fromDevice":"121FD9E6BOYWRPESH8PX5KZY","toDevice":"ee265a9ff0c911eda8eb5254","deviceType":"OwnApp"}[24792] print: {"data":{"num-v1":{"date":1684025806,"val":0.00},"num-v2":{"date":1684025806,"val":1.25},"num-v3":{"date":1684025806,"val":0.00},"num-i1":{"date":1684025806,"val":-0.20},"num-i2":{"date":1684025806,"val":-0.20},"num-i3":{"date":1684025806,"val":-0.50},"num-t1":{"date":1684025806,"val":0.00},"num-t2":{"date":1684025806,"val":0.00},"num-t3":{"date":1684025806,"val":0.00},"num-pwm1":{"date":1684025806,"val":204},"num-pwm2":{"date":1684025806,"val":511},"num-pwm3":{"date":1684025806,"val":818}},"fromDevice":"121FD9E6BOYWRPESH8PX5KZY","toDevice":"ee265a9ff0c911eda8eb5254","deviceType":"OwnApp"}

[[24846] Proto print...
[24848] Freeheap: 24846] ...Failed
[24851] Freeheap: 245476
245476
[24854] [24854] Freeheap: 244304
isJson: {"data":{"data":{"num-v1":{"date":1684025806,"val":0.00},"num-v2":{"date":1684025806,"val":1.25},"num-v3":{"date":1684025806,"val":0.00},"num-i1":{"date":1684025806,"val":-0.20},"num-i2":{"date":1684025806,"val":-0.20},"num-i3":{"date":1684025806,"val":-0.50},"num-t1":{"date":1684025806,"val":0.00},"num-t2":{"date":1684025806,"val":0.00},"num-t3":{"date":1684025806,"val":0.00},"num-pwm1":{"date":1684025806,"val":204},"num-pwm2":{"date":1684025806,"val":511},"num-pwm3":{"date":1684025806,"val":818}},"fromDevice":"121FD9E6BOYWRPESH8PX5KZY","toDevice":"ee265a9ff0c911eda8eb5254","deviceType":"OwnApp"},"fromDevice":"121FD9E6BOYWRPESH8PX5KZY","toDevice":"ee265a9ff0c911eda8eb5254","deviceType":"OwnApp"}
[24919] MQTT Publish...
[24921] Freeheap: 246564
[24923] ERROR: MQTT Disconnected
[24926] Freeheap: 246564
CORRUPT HEAP: Bad head at 0x3ffdb288. Expected 0xabba1234 got 0x3ffdc814
abort() was called at PC 0x400871a1 on core 1

ELF file SHA256: 0000000000000000

Backtrace: 0x40088fd8:0x3ffb1ac0 0x40089255:0x3ffb1ae0 0x400871a1:0x3ffb1b00 0x400872cd:0x3ffb1b30 0x4010efc7:0x3ffb1b50 0x40108f89:0x3ffb1e10 0x40108efd:0x3ffb1e60 0x4008d969:0x3ffb1e90 0x400823ce:0x3ffb1eb0 0x40087099:0x3ffb1ed0 0x4000bec7:0x3ffb1ef0 0x400d452b:0x3ffb1f10 0x400e2d97:0x3ffb1f30 0x400e2e5d:0x3ffb1f90 0x400ee3dc:0x3ffb1fb0 0x4008a266:0x3ffb1fd0

Rebooting...

编译信息

@Tonnp
Copy link
Author

Tonnp commented May 14, 2023

目前排查下来问题基本定位在Blinker.printRtData();
使用Blinker.print();做循环没有问题,然后rtdata会增加时间戳,不知是否json太长会导致服务器主动断开连接(json大概750字节)
另外Blinker.run()放在loop里,循环间隔大概是50ms左右,也会导致内核崩溃
ESP32 Guru Meditation Error: Core 0 panic'ed (LoadProhibited)

希望对排查有帮助

@i3water
Copy link
Collaborator

i3water commented May 17, 2023

从调试信息看可能是一次发送的数据太多导致堆栈不足,可以尝试减少一次发送的数据量进行测试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants