Open Mesihas opened 3 years ago
You can try using an esp32 stack-trace decoder to see where exactly the code aborts. I assume maybe allocating 36K is too much to malloc
for the poor esp32. The memory handling in this library is not optimal, although it did improve greatly since the initial versions. With the stacktrace decoded it might be easier to understand where it crashes and maybe there is a way to optimize that code. Also, note that the decoded stacktrace might contain personal paths in your computer, so if you share it (which will really help!) make sure to censor those :)
Gil
Thanks, I'll have a look at esp32 stack-trace decoder.
Describe the bug not able to receive a message longer than 36k
To Reproduce basically the server sends a payload after a request, at some point (36k) the message is not processed anymore.
This should include:
`#include
include
int xx = ESP.getFreeHeap(); const char ssid = "xx"; //Enter SSID const char password = "xx"; //Enter Password const char* websockets_server_host = "10.0.1.101"; const uint16_t websockets_server_port = 4444; // Enter server port
using namespace websockets;
WebsocketsClient client; void setup() { Serial.begin(115200); Serial.print("principio: "); Serial.println(xx); Serial.print("setup: "); Serial.println(ESP.getFreeHeap()); // Connect to wifi WiFi.begin(ssid, password);
// Serial.println(msg.data());
Serial.println("End of Message---------------------------------------"); Serial.printf("Message T%d B%d Pi%d Po%d C%d stream%d length: %u\n", msg.isText(), msg.isBinary(), msg.isPing(), msg.isPong(), msg.isClose(),msg.isPartial(),msg.rawData().length()); Serial.println(msg.c_str());
}
void loop() { // let the websockets client check for incoming messages if(client.available()) { client.poll(); } delay(500); }
void getSceneList(){ String req ="{\"message-id\":\"11\",\"request-type\":\"GetSceneList\"}"; int messageId = 11; SendRequest(req); Serial.println("Sent request getSceneList message ID 11:"); }
void SendRequest(String req){ client.send(req); //WORKS
}`
Additional context
error message at serial :
Message T1 B0 Pi0 Po0 C0 stream0 length: 62 { "error": "invalid JSON payload", "status": "error" } abort() was called at PC 0x40133ba3 on core 1
Backtrace: 0x4008c434:0x3ffb1cb0 0x4008c665:0x3ffb1cd0 0x40133ba3:0x3ffb1cf0 0x40133bea:0x3ffb1d10 0x40133c97:0x3ffb1d30 0x40133d16:0x3ffb1d50 0x40134175:0x3ffb1d70 0x401345e7:0x3ffb1d90 0x40134631:0x3ffb1dc0 0x400d2a46:0x3ffb1de0 0x400d2a75:0x3ffb1e00 0x400d3416:0x3ffb1e70 0x400d346d:0x3ffb1e90 0x400d0f25:0x3ffb1f90 0x400d6b21:0x3ffb1fb0 0x40088b7d:0x3ffb1fd0
Rebooting... ets Jun 8 2016 00:22:57
NOTE: If i reduce the size of the message a little bit then I can open it. For example this is the same message but smaller and no issues:
Message T1 B0 Pi0 Po0 C0 stream0 length: 36709 { "current-scene": "Welcome 4 2 2 2", "message-id": "11", "scenes": [ {
..... Message with problems when opening: message.txt