https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43570 Bug ID: 43570 Summary: Memory leark in SafeURL abd HtmlScrubber Template::Toolkit filters Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- Right now every request that renders a page using SafeURL or HtmlScrubber leaks the entire template context. It seems to be around 7 to 13 MB per request depending on the page ( almost 8 MB on opac-detail, 11 on circulation.pl, and 13 on moremember.pl ). This memory doesn't get released at the end of the request because the context points to the filter, and the filter points to the context. The reason it hurts so much is what the context is. It's the root of the whole render. Every compiled template, the stash, and everything the stash was holding. On opac-detail.pl that's the Koha::Biblio, the MARC::Record and all the compiled templates. So one stuck context drags a whole page's worth of stuff along with it, and then we do it again on the next request, and the next. This is actually a known issue in TT 2.20+ and was done on purpose: # This causes problems: https://rt.cpan.org/Ticket/Display.html?id=46691 # If the plugin is loaded twice in different templates (one INCLUDEd into # another) then the filter gets garbage collected when the inner template # ends (at least, I think that's what's happening). So I'm going to take # the "suck it and see" approach, comment it out, and wait for someone to # complain that this module is leaking memory. # weaken($this); The call to weaken() was restored in TT 3.1, and they weaken _CONTEXT rather than the plugin itself, which is the same thing my patch will do. -- You are receiving this mail because: You are watching all bug changes.