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

Cees Hek ceeshek at gmail.com
Wed Apr 4 01:13:13 EDT 2012


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?

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


More information about the cgiapp mailing list