Subject: | Bug in Apache::Session::NoSQL when trying to use Apache::Session::Redis |
Date: | Thu, 10 Apr 2014 15:02:15 -0400 |
To: | bug-Apache-Session-NoSQL [...] rt.cpan.org |
From: | John Dunlap <john [...] lariat.co> |
I've recently ported my application from Apache::Session::Postgres to
Apache::Session::Redis and it worked splendidly(Great work!!!) until I
attempted to override the server/port. What I need is to run Redis on a
different server so that my round-robin web server cluster can share the
same in-memory sessions across servers. To prove to myself that the setting
was working, I changed the redis-server port to 6380 and restarted it. I
then changed the server setting in my session configuration and I could no
longer log in. This is the code that I'm using to create the session(Pretty
much strait off the CPAN example page):
tie %session, 'Apache::Session::Redis', $session_id, {
# optional: default to localhost
server => '127.0.0.1:6380',
};
However, it doesn't seem to work. I traced through the code and found what
*appears* to be a bug:
/usr/local/share/perl/5.14.2/Apache/Session/Store/NoSQL.pm
19: - unless ( $self->{cache} = new $module ( $session->{args} ) ) {
19: + unless ( $self->{cache} = new $module ( $session ) ) {
Once I made this change, my sessions started working again on the new port
number. I have this file in my local environment but if I am doing
something wrong, I would really like to know how I can change my code to
make it work.
These are the version that I'm using:
cpan[2]> install Apache::Session::Redis
Apache::Session::Redis is up to date (0.1).
cpan[3]> install Apache::Session::NoSQL
Apache::Session::NoSQL is up to date (0.1).
cpan[4]> install Apache::Session::Store::NoSQL
Apache::Session::Store::NoSQL is up to date (0.02).
cpan[5]> install Redis
Redis is up to date (1.972).
root@john-office:/usr/local/lariat-trunk/log# redis-server --version
Redis server version 2.4.14 (00000000:0)
Cheers!
John