You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jeff <ja...@aquabolt.com> on 2002/05/08 19:05:33 UTC
Apache::Session::File - never returns?
Folks,
The following line:
1) always works when $session_id is undef,
2) sometimes works, and sometimes (about 1 in 5 ) never returns,
when the session_id is set:
tie %session, 'Apache::Session::File',
$session_id, { Directory => '/tmp', LockDirectory => '/tmp' };
I have to stop Apache, and the following entries appear in error log:
(in cleanup) Can't call method "acquire_write_lock" on an undefined
value at /usr/share/perl5/Apache/Session.pm line 569 during global
destruction.
(in cleanup) Can't call method "close" on an undefined value at
/usr/share/perl5/Apache/Session/File.pm line 41 during global
destruction.
Any thoughts on what I might have wrong?
Anyone ideas about what is required for acquire_write_lock to work
on Linux 2.4.4 with Apache/1.3.23 (Unix) Debian GNU/Linux
mod_perl/1.26 mod_ssl/2.8.7 OpenSSL/0.9.6c
Thanks a bunch,
Jeff
Re: Apache::Session::File - never returns?
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> The whole point of the
> session is to save/restore state across requests using a magic
> session_id. It should never be a global across all requests!
well, all requests to the same child, anyway :) keep in mind how package globals scope
under mod_perl, given that each child has its own interpreter (if you weren't already
thinking about it :)
> Jeff
> [who often feels like an idiot in the mod_perl list]
don't. we've all been there, learning this stuff from the ground up. at least you're
investigating stuff yourself instead of waiting for somebody to do it for you.
keep going - it's fun stuff...
--Geoff
RE: Apache::Session::File - never returns?
Posted by Jeff <ja...@aquabolt.com>.
and the answer is... scoping!
A little testing using lsof shows that all the Apache children are
keeping read locks on the session lock file, and that the
aquire_write_lock() function blocks when trying to get LOCK_EX
and the mistake is
$main::global{session} = \%session_hash;
it should of course be
my $session = \%session_hash;
Slaps head! Of course the perl session object should be transient - it
should scope the same as the request object. The whole point of the
session is to save/restore state across requests using a magic
session_id. It should never be a global across all requests!
Jeff
[who often feels like an idiot in the mod_perl list]
-----Original Message-----
From: Jeff [mailto:jaa.perl@aquabolt.com]
Sent: 08 May 2002 18:06
To: modperl@perl.apache.org
Subject: Apache::Session::File - never returns?
Folks,
The following line:
1) always works when $session_id is undef,
2) sometimes works, and sometimes (about 1 in 5 ) never returns,
when the session_id is set:
tie %session, 'Apache::Session::File',
$session_id, { Directory => '/tmp', LockDirectory => '/tmp' };
I have to stop Apache, and the following entries appear in error log:
(in cleanup) Can't call method "acquire_write_lock" on an undefined
value at /usr/share/perl5/Apache/Session.pm line 569 during global
destruction.
(in cleanup) Can't call method "close" on an undefined value at
/usr/share/perl5/Apache/Session/File.pm line 41 during global
destruction.
Any thoughts on what I might have wrong?
Anyone ideas about what is required for acquire_write_lock to work
on Linux 2.4.4 with Apache/1.3.23 (Unix) Debian GNU/Linux
mod_perl/1.26 mod_ssl/2.8.7 OpenSSL/0.9.6c
Thanks a bunch,
Jeff