Hey,
For the sake of thread completion, here's a script which demonstrates
the bug. It turns out to be a Perl bug (5.6.1, at least), not an
Apache::Session bug. I'll post to p5p after I post here.
Note that $foo and %bar are cleaned up by refcount, but %foo isn't
cleaned up until global destruction. This means there must be some bad
interaction between tie(), closures, and global variables, I guess.
-------------------------------------------------------------
#!/usr/bin/perl
use strict;
{
package Dummy;
sub new { bless {@_[1,2]} }
sub TIEHASH { bless {@_[1,2]} }
sub DESTROY { warn "Destroying $_[0]->{name}: $_[0]" }
}
use vars qw(%foo $foo);
{
# Will get cleaned up properly
local $foo = new Dummy(name => '$foo');
# Will get cleaned up properly
my %bar;
tie %bar, 'Dummy', name => '%bar';
# Won't get cleaned up properly
local %foo;
tie %foo, 'Dummy', name => '%foo';
}
------------------------------------------------------------
Destroying %bar: Dummy=HASH(0x632c) at destroy.pl line 9.
Destroying $foo: Dummy=HASH(0x641c) at destroy.pl line 9.
Destroying %foo: Dummy=HASH(0x22ccc) at destroy.pl line 9 during global
destruction.
------------------------------------------------------------
Investigating with Devel::Peek suggests that it's a %foo refcount
problem, it's somehow getting set to 2 after tie(%foo).
-Ken