lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Timeout wraparound bug


From: Sylvain Rochet
Subject: Re: [lwip-users] Timeout wraparound bug
Date: Fri, 17 Feb 2017 15:17:20 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

Hi Fotis,

On Fri, Feb 17, 2017 at 12:44:35PM +0200, Fotis Panagiotopoulos wrote:
> Hi,
> 
> I have a problem with LWIP, where after some time of normal operation, all
> TCP communications die. After lots of headbanging, I found that tcp_tmr()
> stops beeing called.
> 
> I examined the functions sys_check_timeouts() and sys_timeout(), and found
> out that there is a problem when sys_now wraps around.
> 
> Specifically in the file timeouts.c, lines 214-220 the following snippet
> fails:
> 
>   now = sys_now();
>   if (next_timeout == NULL) {
>     diff = 0;
>     timeouts_last_time = now;
>   } else {
>     diff = now - timeouts_last_time;
>   }
> 
> When sys_now() returns 0 (due to wrap around), the diff variable gets a
> huge number (as it is unsigned), and the tcp timer  (and possibly other
> timers), are scheduled for the very very far future, leading in problematic
> TCP communications.
> 
> Anyone faced this problem? Is this a bug in LWIP, or maybe in my porting
> files? Any hints?

At which value does your sys_now() wrap ?  sys_now() must wrap at 2^32-1.

Sylvain

Attachment: signature.asc
Description: Digital signature


reply via email to

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