]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: rawsock: always mark the FD not ready when we're certain it happens
authorWilly Tarreau <w@1wt.eu>
Fri, 28 Feb 2020 13:09:12 +0000 (14:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 28 Feb 2020 15:17:09 +0000 (16:17 +0100)
commit8dd348c90c5c6c5c7ea4a304a1e44692cd4a84ae
treea221a87cc77f747af36a7ee29375933d8f49cee9
parentb045bb221a3d14e9b674265591e2def0e7deb919
MINOR: rawsock: always mark the FD not ready when we're certain it happens

This partially reverts commit 1113116b4a ("MEDIUM: raw-sock: remove
obsolete calls to fd_{cant,cond,done}_{send,recv}") so that we can mark
the FD not ready as required since commit 19bc201c9f ("MEDIUM: connection:
remove the intermediary polling state from the connection"). Indeed, with
the removal of the latter we don't have any other reliable indication that
the FD is blocked, which explains why there are so many EAGAIN in traces.

It's worth noting that a short read or a short write are also reliable
indicators of exhausted buffers and are even documented as such in the
epoll man page in case of edge-triggered mode. That's why we also report
the FD as blocked in such a case.

With this change we completely got rid of EAGAIN in keep-alive tests, but
they were expectedly transferred to epoll_ctl:

  $ ./h1load -n 100000 -t 4 -c 1000 -T 20 -F 127.0.0.1:8001/?s=1k/t=20

  before:
   266331 epoll_ctl 1
   200000 sendto 1
   200000 recvfrom 1
   135757 recvfrom -1
     8626 epoll_wait 1

  after:
   394865 epoll_ctl 1
   200000 sendto 1
   200000 recvfrom 1
    10748 epoll_wait 1
     1999 recvfrom -1
src/raw_sock.c