lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #28605] Write can block when cable unplugged


From: Fabian Koch
Subject: [lwip-devel] [bug #28605] Write can block when cable unplugged
Date: Thu, 14 Jan 2010 11:21:30 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)

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

                 Summary: Write can block when cable unplugged
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: tabascoeye
            Submitted on: Do 14 Jan 2010 11:21:30 GMT
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: Other

    _______________________________________________________

Details:

When doing netconn_write, the codeflow goes through do_write, do_writemore,
tcp_write, tcp_enqueue.

tcp_enqueue checks for the queuelen to be smaller than TCP_SND_QUEUELEN and
returns ERR_MEM if it is bigger. 
BUT tcp_write() does not care with a comment stating that this is a temporary
error.
That is correct when tcp_output() is able to send stuff but without incoming
ACKs this might take forever which will block netconn_write() forever.

This can be fixed by early checking of TCP_SND_QUEUELEN and signalling that
it will be reached by the next write.
This should also make the socket_select() a little less bumpy

In api_msg.c, function do_writemore(), line 1015:
...
    if ((err == ERR_OK) && ((tcp_sndbuf(conn->pcb.tcp) <= TCP_SNDLOWAT) ||
((tcp_sndqlen(conn->pcb.tcp) + 1 >= TCP_SND_QUEUELEN)))) {
      API_EVENT(conn, NETCONN_EVT_SENDMINUS, len);
    }
...

and in tcp.h, line 80/81:

...
#define          tcp_sndqlen(pcb)   ((pcb)->snd_queuelen)
...

Sorry I can't produce an ordinary diff/patch right now, but it's only two
lines change.

-- 
PS: the lwip version field in the savannah Bug reporter misses Version 1.3.2




    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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