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

ESP32 crashes when sending large amount of data using WiFiUDP #8075

Closed
1 task done
bongoo1 opened this issue Apr 13, 2023 · 1 comment
Closed
1 task done

ESP32 crashes when sending large amount of data using WiFiUDP #8075

bongoo1 opened this issue Apr 13, 2023 · 1 comment

Comments

@bongoo1
Copy link

bongoo1 commented Apr 13, 2023

Board

ESP32 Dev Module

Device Description

LAN8720 module and TFT controlled over SPI attached

Hardware Configuration

no

Version

latest master (checkout manually)

IDE Name

platformio with arduino

Operating System

no os

Flash frequency

standard settings

PSRAM enabled

no

Upload speed

115200

Description

my program regularly sends big data packets (about 2000 characters long) using udp. this works fine, but every few hours, the esp32 crashes and reboots.
i stripped down the code and found that this happens on sending the udp packet.
i reduced functionality below to just the part that has been isolated and is responsible for the crash.

the sketch below cannot run. it just shows the part of the program that crashes.

the crash happens while executing the function sendToUdp.

Sketch

WiFiUDP Udp; 

char udpData[2048];

unsigned int localUdpPort = 12331; 
IPAddress broadcastUdpIp = IPAddress(192,168,1,255); 
unsigned int broadcastUdpPort = 12333; 

void setupUdp() {
  Udp.begin(localUdpPort); // Enable UDP listening to receive data
}

void sendToUdp(const char *UDP_packet) {
  Udp.beginPacket(broadcastUdpIp, broadcastUdpPort); 
  Udp.write((const uint8_t*)UDP_packet, strlen(UDP_packet)); 
  Udp.endPacket();         
}

void sendDataFromUdp() {
      sendToUdp(udpData]);
}

void setup() {
...
setupUdp();
...
}

void loop() {
...
strncpy(udpData,"...an array of chars which is about 2000 characters long...",2048);
...
sendDataFromUdp();
...
}

Debug Message

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4008a15d  PS      : 0x00060e30  A0      : 0x800d6b0e  A1      : 0x3ffb2690  
A2      : 0xd8148d30  A3      : 0xd8148d2c  A4      : 0x000000ff  A5      : 0x0000ff00
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x3ffb2650  
A10     : 0x00000001  A11     : 0x00000001  A12     : 0x00000000  A13     : 0x00000023
A14     : 0x007bf178  A15     : 0x003fffff  SAR     : 0x0000000a  EXCCAUSE: 0x0000001c  
EXCVADDR: 0xd8148d30  LBEG    : 0x4008a15d  LEND    : 0x4008a16d  LCOUNT  : 0xffffffff


Backtrace:0x4008a15a:0x3ffb26900x400d6b0b:0x3ffb26a0 0x400d6b5f:0x3ffb26d0 0x400d73f4:0x3ffb26f0 0x400e1301:0x3ffb2820

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@bongoo1 bongoo1 added the Status: Awaiting triage Issue is waiting for triage label Apr 13, 2023
@mrengineer7777 mrengineer7777 added Status: Solved and removed Status: Awaiting triage Issue is waiting for triage labels Apr 14, 2023
@mrengineer7777
Copy link
Collaborator

See PR #7847, #8065. Retest with release 2.0.8 (coming soon!).

Also, check your code for memory leaks. WiFiUDP::beginPacket() would only crash on low memory.

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

No branches or pull requests

2 participants