https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43570

--- Comment #4 from Kyle M Hall (khall) <[email protected]> ---
Created attachment 206476
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206476&action=edit
Bug 43570: SafeURL and HtmlScrubber template plugins leak the template context
on every request

Every request that renders a template using the SafeURL or HtmlScrubber
filter leaks the whole Template::Context: the compiled templates, the
stash and everything in it. That's 7 to 13 MB per request that doesn't
come back until the worker is recycled.

Both plugins call install_filter, which stores a closure over the plugin
in the context's filter provider, while the plugin holds the context in
_CONTEXT. Template::Plugin::Filter has the weaken() that would break the
cycle commented out. Weakening the plugin's reference to the context
fixes it; the context is always alive while a template is being
processed, which is the only time the plugin uses it.

Test Plan:
1) Apply the first patch
2) prove t/db_dependent/Template/Plugin/SafeURL.t
t/db_dependent/Template/Plugin/HtmlScrubber.t
3) Note the "template context is released" subtests fail
4) Set plack_workers to 1 and plack_max_requests to 5000 in koha-conf.xml
5) Restart all the things!
6) Note the RSS of the starman worker
7) Request /cgi-bin/koha/opac-detail.pl?biblionumber=N fifty times,
   using a different biblionumber each time
8) Note the worker has put on about 400 MB!
9) Apply the second patch
10) prove the tests again, note they pass!
11) Restart all the things and repeat steps 6 through 8
12) Note the worker stays put!

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to