[squid-dev] [PATCH] Fix HttpRequest object leaks in Squid 4.0.x

Amos Jeffries squid3 at treenet.co.nz
Thu Mar 10 06:56:12 UTC 2016


On 10/03/2016 5:41 p.m., Nathan Hoad wrote:
> Hello,
> 
> The attached patch fixes a rather profuse memory leak in the Squid
> 4.0.x series where under certain conditions, HttpRequest objects would
> get lost. I can provide more information here if requested,
> specifically a Valgrind trace and configuration to reproduce this.
> 
> I suggest that a better long term solution would be to make the
> members private, and have setter methods to ensure the correct
> unlocking occurs. Alternatively, using a smart pointer, e.g.
> Http::HttpRequestPointer. If people have any recommendations here, let
> me know and I can work towards this.

We should always store HttpMsg hierarchy objects using their Pointer's.
Regardless of whether setters are used.

These HttpMsg/HttpRequest/HttpReply are in a long drawn out transition
right now. Leading to this leak amongst other issues. Any help you can
provide converting object members to Pointer is very welcome.

Thank you. I have applied your fix for now to get trunk stability back.

> 
> Thank you,
> 
> Nathan.
> 
> P.S. I have two more patches that fix less severe memory leaks that
> are quite distinct from one another. Should I submit them as a single
> patch, or multiple patches? At least one of the patches will involve
> some discussion on how to improve it. They are not large.
> 

If they are distinct, then separate patches are better than combined. No
reason to hold up a leak fix because something else needs discussion.

Amos



More information about the squid-dev mailing list