request_header_add adds a memory leak

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Thu, 19 Jul 2012 18:34:37 -0600

Hello,

    I believe the current trunk is profusely leaking memory. There may
be several reasons, but my current suspect is a circular RefCounted
reference that allows neither HttpRequest nor AccessLogEntry to be freed:

    HttpRequest -> AccessLogEntry -> HttpRequest

The circle was created by the request_header_add feature during the
review process, when it was decided that we should reuse the Format API
to expand macros in the added header values. That API needs
AccessLogEntry. This is good news -- there is not much code relying on
the circle existence!

The bad news is that breaking the circle is not trivial. Copying
AccessLogEntry to HttpRequest (instead of linking the two) is not a good
option because the AccessLogEntry object needs to be populated with
values collected throughout the master transaction lifetime -- up until
httpHdrAdd() is called on the server side (and much later when we start
supporting macros in mangled responses).

The mess stems from the fact that AccessLogEntry is not generally
available on the server side. HttpRequest is available there but it
cannot be used for AccessLogEntry smuggling (due to the above loop).

Unless I hear better ideas, I will extend the FwdState::fwdStart() API
to supply an AccessLogEntry (and store it in Server/etc). This may even
help with future plans of converting ALE into some kind of MasterXaction
class.

Cheers,

Alex.
Received on Fri Jul 20 2012 - 00:34:57 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 20 2012 - 12:00:02 MDT