]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: splice: disable it when the system returns EBADF
authorWilly Tarreau <w@1wt.eu>
Mon, 12 Nov 2012 11:00:09 +0000 (12:00 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 12 Nov 2012 11:02:20 +0000 (12:02 +0100)
commit45b8893966394c1eb0ff86f180ab9481bb5528a4
treef31c12130baf0979b27baf87da0dc50084128424
parent674b743067c652cbea6d3e45912b9c37e7ccb3e5
MINOR: splice: disable it when the system returns EBADF

At least on a heavily patched 2.6.35.9, we can see splice() fail
with EBADF :

  recv(6, "789.123456789.123456789.12345678"..., 1049, 0) = 1049
  send(5, "HTTP/1.1 200\r\nContent-length: 10"..., 8030, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_MORE) = 8030
  gettimeofday({1352717854, 515601}, NULL) = 0
  epoll_wait(0x3, 0x40221008, 0x7, 0)     = 0
  gettimeofday({1352717854, 515793}, NULL) = 0
  pipe([7, 8])                            = 0
  splice(0x6, 0, 0x8, 0, 0xfe12c, 0x3)    = -1 EBADF (Bad file descriptor)
  close(6)                                = 0

This clearly is a kernel issue since all FDs are valid here, so let's
simply disable splice() on the connection when this happens so that
the session correctly recovers from that issue using recv().
src/raw_sock.c