~measurement-factory/squid/update-right-headers-on-304

Viewing all changes in revision 14714.

  • Committer: Alex Rousskov
  • Date: 2016-06-15 15:37:44 UTC
  • Revision ID: rousskov@measurement-factory.com-20160615153744-8u15xgiru7r27qmc
Do not make bogus recvmsg(2) calls when closing UDS sockets.

comm_empty_os_read_buffers() assumes that all non-blocking
FD_READ_METHODs can read into an opaque buffer filled with random
characters. That assumption is wrong for UDS sockets that require an
initialized msghdr structure. Feeding random data to recvmsg(2) leads to
confusing errors, at best. Squid does not log those errors, but they
are visible in, for example, strace:

  recvmsg(17, 0x7fffbb, MSG_DONTWAIT) = -1 EMSGSIZE (Message too long)

comm_empty_os_read_buffers() is meant to prevent TCP RST packets. The
function now ignores UDS sockets that are not used for TCP.

TODO: Useless reads may also exist for UDP and some TCP sockets.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: