lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #51122] Mismatched socket->fd_used accounting when usi


From: Tim Cussins
Subject: [lwip-devel] [bug #51122] Mismatched socket->fd_used accounting when using lwip_select
Date: Fri, 26 May 2017 12:41:49 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:53.0) Gecko/20100101 Firefox/53.0

URL:
  <http://savannah.nongnu.org/bugs/?51122>

                 Summary: Mismatched socket->fd_used accounting when using
lwip_select
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: tcussins
            Submitted on: Fri 26 May 2017 04:41:47 PM UTC
                Category: sockets/netconn
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

Hi all,

I've had some trouble with LwIP of late. Recent snapshots, taken from the git
head, have caused assertions in sock_inc_used().

I've completed a bisection this afternoon, and found that commit a38e937d
introduces the problem.

Our configuration uses sockets extensively, and with LWIP_NETCONN_FULLDUPLEX -
a configuration that has been stable until this patch.

I believe I've found part of the issue. As you may know,

lwip_select_inc_sockets_used_set()
and
lwip_select_dec_sockets_used()

are tasked with projecting fdset selections into the fd_used field of struct
lwip_sock.

Unfortunately, both functions fail to anticipate that tryget_socket_unconn()
will actually increment sock->fd_used. As such:

lwip_select_inc_sockets_used_set() calls tryget_socket_unconn() [+1], then
sock_inc_used() explicitly [+1]. Net change = +2

lwip_select_dec_sockets_used() calls tryget_socket_unconn() [+1], before
calling done_socket() [-1]. Net change = 0

See attached patch for an admittedly pretty awful correction.

I still have an issue wherein a tcp simple send benchmark stalls after ~40MB
of data sent (recv remains ok), so this might not be a complete fix, or there
may be another issue elsewhere.

Cheers!
Tim



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 26 May 2017 04:41:47 PM UTC  Name:
0001-sockets.c-Fix-lwip_select-socket-usage-accounting.patch  Size: 2kB   By:
tcussins
Suggested patch.
<http://savannah.nongnu.org/bugs/download.php?file_id=40794>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?51122>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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