lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] LwIP v2.1.2 in UDP client mode gets stuck in etharp_query()


From: Lan Yang
Subject: [lwip-users] LwIP v2.1.2 in UDP client mode gets stuck in etharp_query() after running for a long time without connection?
Date: Wed, 21 Sep 2022 12:08:28 +0800

Hi LwIP users,

I've been having some problems lately with lwIP v2.1.2's udp_send function.
The problem is: LwIP as UDP client gets stuck in etharp_query() after running for a long time without connection. 

Have any of you encountered a similar situation? 
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.

5. After running for about 1 hour, the program asserts in the following three positions (sometimes the self-test will slightly adjust the amount and position of the printed log information).
5.1 assert position 1
https://github.com/RT-Thread/rt-thread/blob/a0ca06b4994d7c4a423b03f272c2c2a86a7bd07f/components/net/lwip/lwip-2.1.2/src/core/ipv4/etharp.c#L973

5.2  assert position 2
https://github.com/RT-Thread/rt-thread/blob/a0ca06b4994d7c4a423b03f272c2c2a86a7bd07f/components/net/lwip/lwip-2.1.2/src/core/pbuf.c#L732

5.3  assert position 3
https://github.com/RT-Thread/rt-thread/blob/a0ca06b4994d7c4a423b03f272c2c2a86a7bd07f/components/net/lwip/lwip-2.1.2/src/core/pbuf.c#L753


Best regards,
Lan






CONFIDENTIALITY NOTICE: The contents of this email and any attachments are intended solely for the addressee(s) and contain confidential and/or privileged information and are legally protected from disclosure unless otherwise indicated. If you received this message by mistake, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited.  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]