I've been having some problems lately with lwIP v2.1.2's udp_send function.
Or would you like to do the same test as me on the machine you are using to see if it gets stuck too?
(In other words...when you use LwIP as a UDP client, if you keep not physically connected to any communication object for a long time, will you get stuck in etharp_query?)It seems that it is not connected to the networking object, so LwIP has been executing the ARP protocol in order to obtain the mac address of the machine where the IP target address is located, and has been queuing the outgoing packet, causing the memory to burst.
Welcome to share and exchange views and experiences~
The steps to reproduce are as follows:1. Migrate LwIP to the local embedded board.
2. Write code to configure the embedded board as UDP Client.
3. Write code to control UDP Client to send UDP frames at a rate of 100 frames per ms, and the length of each frame is 5000 bytes.The program logic is as follows:
3.1 customize a udp_client_send() function, its content is:
/***************udp_client_send() function begin*********************/
void udp_client_send(const char *pData, int16_t len) {
if (udp_send_mutex == RT_NULL) {
rt_kprintf("udp send mutex is NULL");
return;
}
rt_mutex_take(udp_send_mutex, RT_WAITING_FOREVER);
struct pbuf *p;
p = pbuf_alloc(PBUF_TRANSPORT, len, PBUF_RAM);
if (p != NULL) {
pbuf_take(p, pData, len);
udp_send(upcb, p);
pbuf_free(p);
} else {
rt_kprintf("udp_client_send p == NULL\r\n");
}
rt_mutex_release(udp_send_mutex);
}
/***************udp_client_send() function end**********************/
3.2 There are two threads, both of which call udp_client_send();
3.3 Among these two threads, one thread calls udp_client_send() 100 times within 1ms, and the other calls udp_client_send() randomly within 1ms
4. Do not connect the Ethernet port of the embedded board to any other server or computer.