buglwIP - A Lightweight TCP/IP stack - Bugs: bug #52860, sys_timeout mishandling of gaps in...

 
 

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

bug #52860: sys_timeout mishandling of gaps in polling

Submitter:  Ray Ozzie <rozzie>
Submitted:  Wed 10 Jan 2018 07:32:52 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Duplicate
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  2.0.3

Wed 10 Jan 2018 07:35:32 PM UTC, comment #1: 

Duplicate of bug #52748

Dirk Ziegelmeier <dziegel>
Group administrator
Wed 10 Jan 2018 07:32:52 PM UTC, original submission:  

In my (freertos-based) port, I was noticing some extremely long timeout values being passed to sys_arch_mbox_fetch, and the longer my app kept running, the longer the timeout values were growing.  We're talking hundreds of seconds.

After quite a bit of debugging, I found the issue.

In my environment, there are occasional (quite harmless) gaps that occur only during the startup phase of my app that cause some early calls to sys_timeout to see a fairly substantial (seconds) difference between sys_now() and timeouts_last_time.

After a lot of debugging, I found that there became some misordering of the queue of timeout handlers that ultimately caused an otherwise harmless "sys_untimeout" to add huge values to existing timeout entries, causing the aforementioned large-and-growing mbox_fetch timeouts.

The problem turned out to be that the test to see if a new timeout entry should be placed at the head of the queue was wrong.  It wasn't accounting properly for the "diff" bias.

Interestingly, there is somewhat of a kludge a few lines down that implements a workaround for "when stopping at a breakpoint", etc.  It looks as though someone had encountered difficulty in this "high diff" situation, and didn't seem to apply the right fix.

Once I fixed this bug AND removed this kludge, the app is working perfectly with any/all such "high diff" situations that I could find.

Ray Ozzie <rozzie>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #42884:  timeouts.c added by rozzie (13KiB - application/octet-stream - This modified file is based on an original from 2.0.3.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dziegel (Posted a comment)
  • -email is unavailable- added by rozzie (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-01-10 dziegel StatusNone Duplicate
        Open/ClosedOpen Closed
    2018-01-10 rozzie Attached File- Added timeouts.c, #42884

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code