[PATCH] ConnOpener fixes

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Mon, 28 Jan 2013 10:32:28 -0700

Hello,

    The attached patch fixes several ConnOpener problems by relying on
AsyncJob protections while maintaining a tighter grip on various I/O and
sleep states. This patch is identical to the last ConnOpener patch
posted in PREVIEW state. I am now done with valgrind testing. No leaks
were detected, although I doubt my tests were comprehensive enough to
trigger all possible conditions where the unpatched code leaks.

I started with Rainer Weikusat's timeout polishing patch posted a few
days ago, but all bugs are mine.

Here are some of the addressed problems:

* Connection descriptor was not closed when attempting to reconnect
after failures. We now properly close on failures, sleep with descriptor
closed, and then reopen.

* Timeout handler was not cleaned up properly in some cases, causing
memory leaks (for the handler Pointer) and possibly timeouts that were
fired (for then-active handler) after the connection was passed to the
initiator.

* Comm close handler was not cleaned up properly.

* statCounter.syscalls.sock.closes counter was not updated on FD closure.

* Waiting pending accepts were not kicked on FD closure.

* Connection timeout was enforced for each connection attempt instead of
applying to all attempts taken together.

and possibly other problems. The full extent of all side-effects of
mishandled race conditions and state conflicts is probably unknown.

TODO (outside this project scope):
  Polish comm_close() to always reset "Select" state.
  Make connect_timeout documentation in squid.conf less ambiguous.
  Move prevalent conn_ debugging to the status() method?
  Polish Comm timeout handling to always reset .timeout on callback?
  Revise eventDelete() to delete between-I/O sleep timeout?

HTH,

Alex.

Received on Mon Jan 28 2013 - 17:32:44 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 31 2013 - 12:00:08 MST