[cgiapp] CAP::Session causing errors under FastCGI and Plack?

B. Estrade estrabd at gmail.com
Wed Apr 4 09:55:05 EDT 2012


On Wed, Apr 04, 2012 at 03:13:13PM +1000, Cees Hek wrote:
> On Wed, Apr 4, 2012 at 1:51 PM, Jason Crome <cromedome at gmail.com> wrote:
> > I keep banging my head against the wall trying to figure this out. ?I expect that I am doing something else wrong, but whenever I comment out the session initialization logic, my app runs (as well as it can without sessions, that is).
> >
> > I am getting this error under FCGI and PSGI:
> > "[Dispatch] ERROR for request '/': Unknown error: Error executing class callback in init stage: Calling session_config after the session has already been created at /Users/crome/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/CGI/Application/Plugin/Session.pm line 79."
> 
> Hi Jason,
> 
> Does this happen every time?  Or does the first request succeed and
> then subsequent requests fail?  Does it have any problems when you run
> it as a plain old CGI?

It's interesting that you mention this. I was recently made aware of
an issue caused when using CGI.pm under speedy. Perl's lexical scoping
got entangled with speedy's persistence, and cause scoping to be as
intended on the first run, but subsequent runs would fail.

Brett

> 
> The big question for me is:  Are you getting a new CGI::Application
> object on every request, or is the object from the previous request
> being re-used?  If the object is being re-used, then it is not being
> cleared out properly and hence the CAP::Session module thinks the
> session has already been loaded when cgiapp_init calls session_config.
> 
> CAP::Session looks to see if $self->{__CAP__SESSION_OBJ} exists to
> determine if a session has already been loaded.  At the start of your
> cgiapp_init method, look to see if it exists already which should
> point you in the right direction to figuring out what is going on.
> 
> Cheers,
> 
> Cees
> 
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
> 
> 


More information about the cgiapp mailing list