[Catalyst] Production session issue - commercial support inquiry?

Matt Pitts mpitts at a3its.com
Thu Jan 8 16:57:04 GMT 2009


> -----Original Message-----
> From: Sergio Salvi [mailto:sergio.lists at salvi.ca]
> Sent: Thursday, January 08, 2009 11:21 AM
> To: The elegant MVC web framework
> Subject: Re: [Catalyst] Production session issue - commercial support
> inquiry?
> 
> On Thu, Jan 8, 2009 at 10:20 AM, Matt Pitts <mpitts at a3its.com> wrote:
> > A Cat app for one of our clients has been experiencing random
session
> > cross-over issues for the past several months. The first reported
> > instance was on Oct. 16 and I have spent countless hours looking at
> any
> > changes that took place around that time to try to isolate the
> problem
> > without success.
> >
> > Here is an overview of the application setup:
> >
> >  - Catalyst 5.70014
> >  - Catalyst::Plugin::Session 0.20
> >  - single Apache 2.2 load balancer front end handling remote SSL and
> > non-SSL requests
> >  - two backend servers running Cat app via HTTP::Prefork for non-SSL
> > traffic
> >  - each backend also runs Apache/mod_ssl + mod_fastcgi in order to
> > provide an SSL channel to the backends
> >  - session storage via DBIC (was originally memcached)
> >
> 
> [snip]
> 
> Are you using MySQL? If so, are you using strict sql_mode with at
> least sql_mode='STRICT_ALL_TABLES'?

Yes, it is MySQL. No, I don't have any modes set...

mysql> select @@GLOBAL.sql_mode;
+-------------------+
| @@GLOBAL.sql_mode |
+-------------------+
|                   | 
+-------------------+
1 row in set (0.00 sec)

What are the ramifications here?

> This is quite obvious, but have you confirmed your session table was
> created exactly like in the C::P::Session docs? Column sizes,
> nullable/not nullable, etc?

I did it as-per...

mysql> show columns from sessions;
+--------------+----------+------+-----+---------+-------+
| Field        | Type     | Null | Key | Default | Extra |
+--------------+----------+------+-----+---------+-------+
| id           | char(72) | NO   | PRI |         |       | 
| session_data | text     | YES  |     | NULL    |       | 
| expires      | int(11)  | YES  |     | NULL    |       | 
+--------------+----------+------+-----+---------+-------+
3 rows in set (0.00 sec)

Keep in mind that I have seen this problem on 3 different storage
engines (memcached, fastmmap, and DBIC).
 
> Do you have any package variable in your controllers or models?
> 
> Anything using "our $var" or "my $var" in the scope of a package
> instead of being inside a sub foo { my $var = xxx } in your
> controllers or models?

Yes, but only as read-only constants. If I'm writing to a package
variable somewhere it's unintentional. I'll check into this further.

> Are you using any closures and/or coderefs?

Yes, but again, unless I've made a mistake somewhere, I'm using them
carryfully - mainly as form validation routines. I'll look to verify.
 
> The behaviour you're describing sounds to me that you have a global
> variable somewhere. A crazy, quick way to figure that out would be to
> set your application workers (the child process that actually handles
> the requests) to EXIT/DIE after each request, so every new request
> gets a brand new process without reusing existing vars. You want
> something similar to "MaxRequestsPerChild 1" if you were using
> mod_perl.

I might look at doing this for a while and seeing if it disappears. Is
there a good place to do this without blowing up the response? Maybe a
custom finalize...

sub finalize {
  my $c = shift;

  $c->NEXT::finalize(@_);

  exit(0);
}

Thanks very much for the response.

v/r
-matt pitts



More information about the Catalyst mailing list