From: | gregoa [...] cpan.org |
Subject: | Creates circular reference to Catalyst context leading to memory leak |
We have the following bug reported to the Debian package of
Catalyst-Controller-FormBuilder (https://bugs.debian.org/794598):
It doesn't seem to be a bug in the packaging, so you may want to take
a look. Thanks!
------8<-----------8<-----------8<-----------8<-----------8<-----
Package: libcatalyst-controller-formbuilder-perl
Version: 0.06-3~asd1
Severity: important
Tags: patch
CatalystX::LeakChecker found a circular reference in my app. The below
patch appears to fix, and doesn't seem to break anything...
I think this is caused by the Plack changes in Catalyst 5.9, but I
wasn't able to test if it happened on older versions of Catalyst as
well.
diff --git a/lib/Catalyst/Controller/FormBuilder/Action.pm b/lib/Catalyst/Controller/FormBuilder/Action.pm
index be476b7..29fad7a 100644
--- a/lib/Catalyst/Controller/FormBuilder/Action.pm
+++ b/lib/Catalyst/Controller/FormBuilder/Action.pm
@@ -133,6 +133,7 @@ sub execute {
my $form = $self->_setup_form(@_);
Scalar::Util::weaken($form->{c});
+ Scalar::Util::weaken($form->{params});
$controller->_formbuilder($form);
$self->maybe::next::method(@_);
$controller->_formbuilder($form); # keep the same form in case of forwards
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing'), (200, 'unstable'), (150, 'stable'), (100, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.0.1-p+ (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages libcatalyst-controller-formbuilder-perl depends on:
ii libcatalyst-perl 5.90075-2
ii libcgi-formbuilder-perl 3.09-3
ii libclass-data-inheritable-perl 0.08-2
ii libclass-inspector-perl 1.28-1
ii libmro-compat-perl 0.12-1
ii libtest-www-mechanize-catalyst-perl 0.59-1
ii libtie-ixhash-perl 1.23-2
ii perl 5.20.2-6
libcatalyst-controller-formbuilder-perl recommends no packages.
libcatalyst-controller-formbuilder-perl suggests no packages.
-- no debconf information
------8<-----------8<-----------8<-----------8<-----------8<-----
Thanks for considering,
gregor herrmann,
Debian Perl Group