Sending data over UDP socket crashes my system
Posted: Tue Sep 09, 2025 7:53 pm
Hi,
My application was created with ESP-IDF v4.x and the syslog logging worked just fine.
In jan 2025 I moved to ESP-IDF 5.4.1 which required me to adjust source code to match the new framework, but after that it functions as expected, except for the syslog logging althoug I did not change the logging module.
My application has a main task as created by the ESP-IDF, and 2 additional tasks (one on each core) that run a worker thread to support sub-tasks. In these subtasks we have 2 HTTP servers, 1 MQTT client and a TCP protocol driver. These all use non-blocking TCP sockets.
The logging module logs to console, a weblog and syslog over UDP socket.
When I enable syslogging I notice that the tasks die and the complete application is not responsive. Via a recovery method I can disable the syslogging and then the system works fine again.
What I notice is that sending data over the UDP socket (writeLine:sendto) returns ENOMEM after a few writes, and then we don't talk about big data, see example below.
From the moment writeLine:sendto returns err=12 (ENOMEM) the application starts dying as if memory is being eaten.
I compared sdkconfig as used in ESP-IDF v4.x and 5.4.1 but I don't see a problem
Anybody an idea?
Thx, Jo
>>>
2025-09-09,20:57:51,D,SNTP,!Initialising...
writeLine:sendto(46)
2025-09-09,20:57:51,I,HTPS,!Started
writeLine:sendto(62)
2025-09-09,20:57:51,I,MQTC,>Connecting to broker...
writeLine:sendto(60)
2025-09-09,20:57:51,I,RPCS,!XMLRPC server started
writeLine:sendto(64):err=12
2025-09-09,20:57:51,I,MQTC,<Connected to 192.168.0.10
writeLine:sendto(80):err=12
<<<
My application was created with ESP-IDF v4.x and the syslog logging worked just fine.
In jan 2025 I moved to ESP-IDF 5.4.1 which required me to adjust source code to match the new framework, but after that it functions as expected, except for the syslog logging althoug I did not change the logging module.
My application has a main task as created by the ESP-IDF, and 2 additional tasks (one on each core) that run a worker thread to support sub-tasks. In these subtasks we have 2 HTTP servers, 1 MQTT client and a TCP protocol driver. These all use non-blocking TCP sockets.
The logging module logs to console, a weblog and syslog over UDP socket.
When I enable syslogging I notice that the tasks die and the complete application is not responsive. Via a recovery method I can disable the syslogging and then the system works fine again.
What I notice is that sending data over the UDP socket (writeLine:sendto) returns ENOMEM after a few writes, and then we don't talk about big data, see example below.
From the moment writeLine:sendto returns err=12 (ENOMEM) the application starts dying as if memory is being eaten.
I compared sdkconfig as used in ESP-IDF v4.x and 5.4.1 but I don't see a problem
Anybody an idea?
Thx, Jo
>>>
2025-09-09,20:57:51,D,SNTP,!Initialising...
writeLine:sendto(46)
2025-09-09,20:57:51,I,HTPS,!Started
writeLine:sendto(62)
2025-09-09,20:57:51,I,MQTC,>Connecting to broker...
writeLine:sendto(60)
2025-09-09,20:57:51,I,RPCS,!XMLRPC server started
writeLine:sendto(64):err=12
2025-09-09,20:57:51,I,MQTC,<Connected to 192.168.0.10
writeLine:sendto(80):err=12
<<<