-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Wifi-UDP: sendto return ENOMEM only with short buffer or if a client is disconnected (IDFGH-5068) #6852
Comments
Thanks for the very detailed report, and sorry for the inconvenience, we will look into. |
@pbruynbroeck Thanks for sharing the extra details. |
hi @pbruynbroeck thanks for reporting. A. Why when the size of the buffer increase (but the number of packet doesn't change), sendto never return -1 ? B. Only on 4.2 (not every time), when a client is disconnected (power off), no event has observed, sendto return -1 and errno returnENOMEM...: This issue is a little complicated. |
Hi @MaxwellAlan, A. Why do not return the error when the packet is fragmented ? B.1 So, what its your advice to detecting a disconnection ? |
How long this timeout last ? Can we reduce it ? |
hi @pbruynbroeck , you can try esp_wifi_set_ps(WIFI_PS_NONE) to disable power save and test, both sta and softap. |
@pbruynbroeck Thanks for reporting, would you please help share if any updates for this issue? Thanks. |
Thanks for reporting, will close due to short of feedback, feel free to reopen. |
we have the same problem, I want to ask that you have solved the problem or not |
I have the same problem too. And during a while of sendto() cycle, it always report ENOMEM and crash. |
The simplest easy fix is to add a vTaskDelay() after sendto() in the loop. ENOMEM occurs more on single-core ESP32.
|
The default wifi station config (WIFI_INIT_CONFIG_DEFAULT) uses static TX buffer type (CONFIG_ESP32_WIFI_TX_BUFFER_TYPE = 0) whether you're using PSRAM or not. The IDF documentation recommends dynamic TX buffer for non PSRAM use, and static for when you have access to this extra memory. In higher latency scenarios this caused enomem issues for me. Changing the TX buffer type to dynamic seems to have solved this issue. Also increasing the number of dynamic TX buffers can also help, at the expense of higher mem usage. Redefining : |
Environment
Problem Description
In this project, the ESP send UDP data to two clients. Every second, we send 15 packets of data at each client.
As is done in the
iperf.c
example, whensendto
return-1
, we add a delay and re-callsendto
iferrno == ENOMEM
:We have observed different behavior between the esp-idf 4.2-rc and 4.0.1 if we change the packet size. (The number of packet per second doesn't change !)
sendto
time (us)A. Why when the size of the buffer increase (but the number of packet doesn't change),
sendto
never return -1 ?B. Only on 4.2 (not every time), when a client is disconnected (power off), no event has observed,
sendto
return -1 and errno returnENOMEM
...:Code to reproduce this issue
Code for esp-idf 4.0.1: wifi_udp_4_0_1.tar.gz
Code for esp-idf 4.2-rc: wifi_udp_4_2.tar.gz
The text was updated successfully, but these errors were encountered: