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

Jason A. Crome cromedome at gmail.com
Wed Apr 4 09:43:23 EDT 2012


It actually fails from the very first request.  Works fine under standard CGI and mod_perl.

I threw some debugging in cgiapp_init() and $self->{__CAP__SESSION_OBJ} is undef at the start of it.  We use a fair amount of AJAX calls in the application, so I even tested parts of the application that are free of AJAX with the same result.  

As far as running the application goes, for anything other than vanilla CGI, we enter the application through the use of CGI::Application::Dispatch.

Not sure if the extra information helps… I will keep poking around.  

Jason A. Crome / CromeDome
DEVNET, Inc. - Cutting Edge Property Tax and Appraisal Solutions - http://www.devnetinc.com
--
AIM: TheOneCromeDome
Twitter: http://www.twitter.com/cromedome
Blog: http://crome-plated.tumblr.com/
CPAN: http://search.cpan.org/~cromedome/
github: http://github.com/cromedome
Bitbucket: https://bitbucket.org/cromedome/

On Apr 4, 2012, at 8:55 AM, B. Estrade wrote:

> 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://lists.openlib.org/mailman/listinfo/cgiapp    ##
>> ##                                                            ##
>> ##  Web archive:   http://lists.openlib.org/pipermail/cgiapp/   ##
>> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
>> ##                                                            ##
>> ################################################################
>> 
>> 
> 
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://lists.openlib.org/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://lists.openlib.org/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
> 



More information about the cgiapp mailing list