buglwIP - A Lightweight TCP/IP stack - Bugs: bug #51033, LWIP_ASSERT while doing repetitive...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #51033: LWIP_ASSERT while doing repetitive transmission

Submitted by:  preet <preetpal>
Submitted on:  Tue 16 May 2017 01:34:08 AM UTC  
 
Category: IPv4Severity: 3 - Normal
Item Group: Crash ErrorStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: 2.0.2

(Jump to the original submission Jump to the original submission)

Thu 18 May 2017 07:32:55 AM UTC, comment #10:

I already thought it's something like this... :-)

Simon Goldschmidt <goldsimon>
Project Administrator
Wed 17 May 2017 11:24:26 PM UTC, comment #9:

Found the REAL root cause. When the linkoutput function called our Ethernet output, and all of the ethernet transmit descriptors were consumed, we returned with an error:

The problem is that we did not take away the offset of the ETH_PAD_SIZE which was added upon entry to the function.

This issue can be closed.

preet <preetpal>
Wed 17 May 2017 10:53:13 PM UTC, comment #8:

Simon,

I'm working with Preet on this issue. We were able to identify the root cause of the LWIP_ASSERT. The problem occurs when we have fully consumed all available descriptors inside our Ethernet tx function and return ERR_BUF to the calling function inside LWIP. Our solution was to place a system wait inside the transmit function until the tx output was no longer full rather than exiting the tx function and returning an error.

Not sure why LWIP is handling ERR_BUF returns with an assert.

Fayek <fwahhab>
Tue 16 May 2017 08:39:20 PM UTC, comment #7:

Yes, tcpip_input is passed to the input function:

preet <preetpal>
Tue 16 May 2017 07:33:16 PM UTC, comment #6:

> and pass it to the LWIP using the input function pointer of
> their own interface:
> e0_interface.input(pbuf, e0_interface)


... and you pass 'tcpip_input' as input function when setting up the netifs via 'netif_add()', I guess?

In that case, it looks like a bug in TCP_OVERSIZE. I'll see if I can reproduce that...

Simon Goldschmidt <goldsimon>
Project Administrator
Tue 16 May 2017 07:26:27 PM UTC, comment #5:

1) Reproduced it with Nagle algorithm off and a simple loop to calls send() function inside the loop.

2) The application uses two Ethernets and I do not believe there are any threading issues
- E0_rx interrupt just posts a counting semahore
- Likewise, E1_rx posts a different E1_cnt_sem
- The two sleeping tasks for each ethernet, namely E0_rx_task and E1_rx_task, take the semaphore
- Sleeping tasks read their own Ethernet descriptor, pull a pbuf_alloc() and pass it to the LWIP using the input function pointer of their own interface:
e0_interface.input(pbuf, e0_interface)

preet <preetpal>
Tue 16 May 2017 07:09:56 PM UTC, comment #4:

1) pbuf_cat() is called multiple times from tcp_write(). Could you tell us the line please?

2) Are you absolutely sure you don't have threading issues? With so many people on the lists, I keep forgetting who I already asked this, so make sure e.g. you don't pass RX packets into lwIP from interrupt (i.g. call ethernet_input() from interrupt or pass anything else than 'tcpip_input' to netif_add()) while using sockets (that uses tcpip_thread()).

Simon Goldschmidt <goldsimon>
Project Administrator
Tue 16 May 2017 02:23:24 AM UTC, comment #3:

One more important update:
This behavior only occurs when the Nagle algorithm is disabled

preet <preetpal>
Tue 16 May 2017 02:06:19 AM UTC, comment #2:

Disregard the previous comment... it is still hitting the assertion.

p->total_len was 67
p->len was 65

The assertion seems to want both values to be equal to each other.

preet <preetpal>
Tue 16 May 2017 01:59:02 AM UTC, comment #1:

As I as fiddling with the LWIP options, it looks like I introduced this problem. When I use the default settings, then it works:

Uncommenting the options above makes it hit the assertion but commenting them out to revert to the defaults at opts.h makes it work.

preet <preetpal>
Tue 16 May 2017 01:34:08 AM UTC, original submission:

During some rigorous LWIP tests, I hit an LWIP exception while using the following code:

Stack trace (from highest to lowest)
- send()
- lwip_send()
- netconn_write_partly()
- tcpip_send_msg_wait_sem()
- lwip_netconn_do_write()
- lwip_netconn_do_writemore()
- tcp_write()
- pbuf_cat()
- Assert at: LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);

I get about 4-5 lines from the for loop before the assertion hits. I am using memory pools with these options:

More LWIP options:

preet <preetpal>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by fwahhab (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by preetpal (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 18 May 2017 07:32:55 AM UTCgoldsimonStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1