tcp_active_pcbs got corrupted in LwIP 2.0.3

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

tcp_active_pcbs got corrupted in LwIP 2.0.3

Yasir Arafat
Hi,
I am using LwIP 2.0.3 with FreeRTOS version 10. There is separate
'ethernetif_input' task which handles Ethernet. We are running httpd.c
server over raw api as provided by LwIP stack. The priority of Ethernet task
is 2nd most among all threads. It is working fine but randomly somehow
'tcp_active_pcbs' got corrupted and becomes  circular linked list of 'pcb'.
The code got stuck in 'tcp_in.c' under loop 'for (pcb = tcp_active_pcbs; pcb
!= NULL; pcb = pcb->next) '.
This happens most of time when server(controller) is running and if the
controller get restart.
We are starting 'ethernetif_input' task only after all the initialization
takes place.  

I tried debugging hard but i don't see anything. That is why I am writing
for the help.

Thanks in advance.  



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: tcp_active_pcbs got corrupted in LwIP 2.0.3

goldsimon@gmx.de
Am 09.05.2019 um 11:45 schrieb Yasir Arafat:

> Hi,
> I am using LwIP 2.0.3 with FreeRTOS version 10. There is separate
> 'ethernetif_input' task which handles Ethernet. We are running httpd.c
> server over raw api as provided by LwIP stack. The priority of Ethernet task
> is 2nd most among all threads. It is working fine but randomly somehow
> 'tcp_active_pcbs' got corrupted and becomes  circular linked list of 'pcb'.
> The code got stuck in 'tcp_in.c' under loop 'for (pcb = tcp_active_pcbs; pcb
> != NULL; pcb = pcb->next) '.
> This happens most of time when server(controller) is running and if the
> controller get restart.
> We are starting 'ethernetif_input' task only after all the initialization
> takes place.
>
> I tried debugging hard but i don't see anything. That is why I am writing
> for the help.

Have you tried searching for similar problems people had in the past? If
so, you would have found that you're probably violating lwIP's threading
requirements...

See also
https://www.nongnu.org/lwip/2_1_x/multithreading.html
and
https://www.nongnu.org/lwip/2_1_x/pitfalls.html

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: tcp_active_pcbs got corrupted in LwIP 2.0.3

Yasir Arafat
In reply to this post by Yasir Arafat
Hi, Thank for reply.
But still I am facing problem.
Basically my implemented based on the example provided by ST-
1. 'ethernet_input' thread take data from Ethernet driver and pass to
'tcpip_input' . Which then passes data
    to 'tcpip_thread' through message(mail box).
2. 'tcpip_thread' take input data through mail box and call all raw api (as
I am running httpd.c server).

No other threads are using RAW api directly.
I tried core locking as you suggested , performance gets better in term of
tcp_active_pcb corruption. But still some time while client Established if
we restart controller it got tcp_active_pcb corrupted.
I don't want to core lock because of there would be chances of priority
inversion.
Both thread has the same priority.


Thanks for the help.



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: tcp_active_pcbs got corrupted in LwIP 2.0.3

goldsimon@gmx.de
Am 23.05.2019 um 13:50 schrieb Yasir Arafat:

> Hi, Thank for reply.
> But still I am facing problem.
> Basically my implemented based on the example provided by ST-
> 1. 'ethernet_input' thread take data from Ethernet driver and pass to
> 'tcpip_input' . Which then passes data
>      to 'tcpip_thread' through message(mail box).
> 2. 'tcpip_thread' take input data through mail box and call all raw api (as
> I am running httpd.c server).
>
> No other threads are using RAW api directly.
> I tried core locking as you suggested ,

I suggested to use core locking? When?

> performance gets better in term of
> tcp_active_pcb corruption. But still some time while client Established if
> we restart controller it got tcp_active_pcb corrupted.
> I don't want to core lock because of there would be chances of priority
> inversion.
> Both thread has the same priority.

Well, I can't debug your setup, but corrupted lists *nearly always* had
to do with violating lwIP's threading requirements in the past.

And using and example provided by ST certainly does *not* help against
this. In the past, such vendor examples have been some of the worst -
not necessarily ST, but they weren't the best, either...

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users