Embedded lwIP application stops working after 4-5 days

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

Embedded lwIP application stops working after 4-5 days

peter
Hi

I am working on an embedded application in which I use lwIP to
periodically send HTTP packets to a webserver (as TCP packets). It works
fine for 4-5 days and then suddenly stops working. I have enabled lwIP
stats in my lwipopts.h and it is outputting lwIP status to the UART. I
captured this output to a file and also used Wireshark to capture the
Ethernet traffic.

In the lwIP log file, I see that around the time when it stops working,
the fields "max" and "err" in the MEM UDP_PCB section contains the
number 4294967295 (2^32 - 1) which is strange, since these fields are 0,
1 or 2 in the long period where there is no problems. This indicates to
me that some kind of overflow is happening in the memory allocated to
lwIP? Or could it be something else?

In the Wireshark log, I can see that after my application is doing a
HTTP POST, it usually gets a HTTP OK from the server as it is supposed
to do. When things go wrong, this does not happen. After that, the
router can no longer detect the microcontroller.

I originally posted a similar question on the TI-E2E Community since I
am using the Texas Instruments TM4C129XL LaunchPad Evaluation Kit (which
is an ARM Cortex M4F based microcontroller with Ethernet PHY and other
stuff on board). I got some responses to my question -- including the
suggestion that I turn off UDP in lwipopts.h. I cannot do that, since I
am using DHCP.

This thread
(http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/519748/1892060#1892060)
appears to be dead now, which is why I am writing to this mailing list.

By the way, I am using lwip-1.4.1 as supplied with TivaWare (TI's C
library for the TM4C-series microcontrollers).

So, I am hoping that an experienced lwIP user or lwIP developer can
explain the meaning of "max" and "err" in the MEM UDP_PCB section and
what could cause the strange values in these fields. Hopefully that
could lead to a solution.

Any help is very appreciated - thanks in advance :-)

Regards,
Peter Haagerup.

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

Re: Embedded lwIP application stops working after 4-5 days

Gisle Vanem
[hidden email] wrote:

> In the lwIP log file, I see that around the time when it stops working, the fields "max" and "err" in the MEM UDP_PCB
> section contains the number 4294967295 (2^32 - 1) which is strange, since these fields are 0, 1 or 2 in the long period
> where there is no problems. This indicates to me that some kind of overflow is happening in the memory allocated to
> lwIP? Or could it be something else?
...

> I originally posted a similar question on the TI-E2E Community since I am using the Texas Instruments TM4C129XL
> LaunchPad Evaluation Kit (which is an ARM Cortex M4F based microcontroller with Ethernet PHY and other stuff on board).
> I got some responses to my question -- including the suggestion that I turn off UDP in lwipopts.h. I cannot do that,
> since I am using DHCP.

Just an idea, you could try:
  #define LWIP_DNS_SECURE 0

in your lwipopts.h. But I've really no idea if that leak is happening
in dns.c or somewhere else. Put in some trace-code?


--
--gv

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

Re: Embedded lwIP application stops working after 4-5 days

goldsimon@gmx.de
Peter Haagerup wrote:
> the fields "max" and "err" in the MEM UDP_PCB section contains the number 4294967295 (2^32 - 1) which is strange

That's really strange: 'err' is only increased but never decreased.
Also, by default, the stats counters are u16_t, not u32_t.
I don't expect disabling UDP to fix this problem...
Why don't you put an assert in memp.c where 'used' is decremented: just add

  "LWIP_ASSERT("double-free", lwip_stats.memp[type].used != 0);"

before

  "MEMP_STATS_DEC(used, type);"

and you should be able to see if it really is an underflow.


Gisle Vanem wrote:
> Just an idea, you could try:
> #define LWIP_DNS_SECURE 0

Now I really don't see what this should change when using 1.4.1, unless TI has backported a fix to their 1.4.1 (in which case it wouldn't be 1.4.1 ...)

Simon

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

Re: Embedded lwIP application stops working after 4-5 days

peter
Hi Simon

Thank you for your response. I have inserted the assert, so hopefully it
will reveal something in the next 5 days or so.

Regards,
Peter.

Simon Goldschmidt skrev den 17.06.2016 12:52:

> Peter Haagerup wrote:
>> the fields "max" and "err" in the MEM UDP_PCB section contains the
>> number 4294967295 (2^32 - 1) which is strange
>
> That's really strange: 'err' is only increased but never decreased.
> Also, by default, the stats counters are u16_t, not u32_t.
> I don't expect disabling UDP to fix this problem...
> Why don't you put an assert in memp.c where 'used' is decremented: just
> add
>
>   "LWIP_ASSERT("double-free", lwip_stats.memp[type].used != 0);"
>
> before
>
>   "MEMP_STATS_DEC(used, type);"
>
> and you should be able to see if it really is an underflow.
>
>
> Gisle Vanem wrote:
>> Just an idea, you could try:
>> #define LWIP_DNS_SECURE 0
>
> Now I really don't see what this should change when using 1.4.1,
> unless TI has backported a fix to their 1.4.1 (in which case it
> wouldn't be 1.4.1 ...)
>
> Simon
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/lwip-users

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

Re: Embedded lwIP application stops working after 4-5 days

UlyssesFonseca
Hello everybody,

I know this post is no longer updated, but i have the same problem like
Peter, and i don't know what i do.
If anybody can help me, will be great.

Thanks



--
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