[PREVIEW] ConnOpener fixes

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Thu, 24 Jan 2013 19:06:30 -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. It is in PREVIEW state because I would like to do more
testing, but it did pass basic tests, and I am not currently aware of
serious problems with the patch code.

I started with Rainer Weikusat's timeout polishing patch posted
yesterday, 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.

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

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

TODO: Needs more testing, especially around corner cases.
      Does somebody need more specific callback cancellation reasons?
      Consider calling comm_close instead of direct write_data cleanup.
      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?
      Consider revising eventDelete() to delete between-I/O sleep
      timeout.

Feedback welcomed.

Thank you,

Alex.

Received on Fri Jan 25 2013 - 02:06:41 MST

This archive was generated by hypermail 2.2.0 : Fri Jan 25 2013 - 12:00:09 MST