Skip Menu |

This queue is for tickets about the Maypole CPAN distribution.

Report information
The Basics
Id: 29984
Status: resolved
Priority: 0/
Queue: Maypole

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

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



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>
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.
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

From: TEEJAY [...] cpan.org
On Sun Oct 14 12:41:33 2007, ben@decadent.org.uk wrote: Show quoted text
> 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
From: TEEJAY [...] cpan.org
On Sun Oct 14 12:41:33 2007, ben@decadent.org.uk wrote: Show quoted text
> 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