Hi folks,

I was testing haproxy-1.5-dev22 on SmartOS (an illumos-based system)
and ran into a problem.  There's a small window after non-blocking
connect() is called, but before the TCP connection is established,
where recv() may return ENOTCONN.  On Linux, the behaviour here seems
to be always to return EAGAIN.  The fix is relatively trivial, and
appears to make haproxy work reliably on current SmartOS (see patch
below).  It's possible that other UNIX platforms exhibit this
behaviour as well.

Does this fix appear to be acceptable?


--- haproxy-1.5-dev22/src/raw_sock.c    2014-02-02 23:41:29.000000000 +0000
+++ haproxy-1.5-dev22-PATCHED/src/raw_sock.c    2014-03-03
21:38:45.232833332 +0000
@@ -309,7 +309,7 @@
                else if (ret == 0) {
                        goto read0;
                }
-               else if (errno == EAGAIN) {
+               else if (errno == EAGAIN || errno == ENOTCONN) {
                        fd_cant_recv(conn->t.sock.fd);
                        break;
                }


Cheers.

-- 
Joshua M. Clulow
UNIX Admin/Developer
http://blog.sysmgr.org

Reply via email to