Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.

X Report information
Id: 29984
Status: resolved
Left: 0 min
Priority: 0/0
Queue: Maypole

Owner: Nobody
Requestors: ben [...] decadent.org.uk
Cc:
AdminCc:

Severity: (no value)
Broken in: (no value)
Fixed in: 2.13




X History Display mode: Brief headersFull headers
#   Sun Oct 14 12:41:33 2007 ben[...]decadent.org.uk - Ticket created  
Subject: Not compatible with mod_perl in multi-threaded Apache 2
Date: Sun, 14 Oct 2007 17:41:19 +0100
To: bug-Maypole[...]rt.cpan.org
From: Ben Hutchings <ben[...]decadent.org.uk>
[text/plain 1.2k]
Maypole::Model::Base::FETCH_CODE_ATTRIBUTES uses references as hash
keys. Hash keys are just strings, not ordinary scalars, so if the
interpreter is cloned, as it will be in multithreaded configurations of
Apache, these references become invalid. The module needs to store the
references in the hash values and then rehash after cloning. Suggested
fix:

--- maypole.orig/lib/Maypole/Model/Base.pm
+++ maypole/lib/Maypole/Model/Base.pm
@@ -12,14 +12,23 @@
shift; # class name not used
my ($coderef, @attrs) = @_;

- $remember{$coderef} = \@attrs;
+ $remember{$coderef} = [$coderef, \@attrs];

# previous version took care to return an empty array, not sure why,
# but shall cargo cult it until know better
return;
}

-sub FETCH_CODE_ATTRIBUTES { @{ $remember{$_[1]} || [] } }
+sub FETCH_CODE_ATTRIBUTES { @{ $remember{$_[1]}->[1] || [] } }
+
+sub CLONE {
+ # re-hash %remember
+ for my $key (keys %remember) {
+ my $value = delete $remember{$key};
+ $key = $value->[0];
+ $remember{$key} = $value;
+ }
+}

sub process {
my ( $class, $r ) = @_;
-- END --

Ben.

--
Ben Hutchings
Lowery's Law:
If it jams, force it. If it breaks, it needed replacing anyway.

[application/pgp-signature 189b]
Message body not shown because it is too large or is not plain text.
#   Thu Apr 17 15:50:28 2008 TEEJAY - Correspondence added  
From: TEEJAY[...]cpan.org
[text/plain 490b]
On Sun Oct 14 12:41:33 2007, ben[...]decadent.org.uk wrote:
> Maypole::Model::Base::FETCH_CODE_ATTRIBUTES uses references as hash
> keys. Hash keys are just strings, not ordinary scalars, so if the
> interpreter is cloned, as it will be in multithreaded configurations of
> Apache, these references become invalid. The module needs to store the
> references in the hash values and then rehash after cloning. Suggested

Fix applied in SVN revision 586 due for 2.13 release before end of April
#   Thu Apr 17 15:52:33 2008 RT_System - Status changed from 'new' to 'open'  
#   Thu Apr 17 15:54:50 2008 TEEJAY - Correspondence added  
From: TEEJAY[...]cpan.org
[text/plain 490b]
On Sun Oct 14 12:41:33 2007, ben[...]decadent.org.uk wrote:
> Maypole::Model::Base::FETCH_CODE_ATTRIBUTES uses references as hash
> keys. Hash keys are just strings, not ordinary scalars, so if the
> interpreter is cloned, as it will be in multithreaded configurations of
> Apache, these references become invalid. The module needs to store the
> references in the hash values and then rehash after cloning. Suggested

Fix applied in SVN revision 586 due for 2.13 release before end of April
#   Mon Apr 21 12:17:40 2008 TEEJAY - Fixed in 2.13 added  
#   Mon Apr 21 12:17:40 2008 TEEJAY - Status changed from 'open' to 'resolved'