Fri 26 May 2017 04:41:47 PM UTC, original submission:
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
|