You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mark Stosberg <ma...@summersault.com> on 2004/03/12 22:11:46 UTC

[mp1] debugging: DBI commits delayed until server shutduwn

Hello,

I've got myself into a modperl pickle that I can't figure out.

As best as I understand what's happening, some database inserts are
being delayed until server shutdown time, instead happening during
the scripts normal execution time.

I'm inserting a row into a session table. I figured out the delay was
happening by checking the session_id, and then trying to select the row
in the session table for it. Initially, it's not found. However, after
the modperl server is restarted, it appears. 

What could cause this?

The applications runs fine under CGI, and an older version ran fine
under mod_perl, with only minor config file changes in the session
handling.

I followed through on some suspicions I thought of, but they didn't pan
out:

- A "SELECT ... FOR UPDATE" is used in the session handling. Removing
  "FOR UPDATE" didn't change the results.

- I added a "teardown" routine that always explicitly rollbacked any 
  uncommited transactions and disconnected. No effect.


Finally, I should note that the applications doesn't /always/ fail under
mod_perl. If test it my web browser (Firefox), it passes. However, using    
WWW::Mechanize a browser, it fails: Here's are some results from testing
it different ways:

 - PASS CGI via WWW::Mechanize browser
 - PASS mod_perl via Mozilla Firefox
 - PASS CGI via w3m browser
			    
 - FAIL mod_perl via WWW::Mechanize browser
 - FAIL mod_perl via w3m browser

I'm out of any ideas. Any wild guesses appreciated. :) 

Here are the details of my environment:

 FreeBSD 5.1
 Perl 5.8.0
 Apache/1.3.28 (Unix) mod_perl/1.29
 DBI 1.41
 Apache::DBI .94
 DBD::Pg 1.32
 Postgres 7.3.4.

I'm using CGI::Session with the CGI::Session::PureSQL driver.

Thanks!

	Mark

-- 
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   mark@summersault.com     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp1] debugging: DBI commits delayed until server shutduwn

Posted by Mark Stosberg <ma...@summersault.com>.
On 2004-03-12, Perrin Harkins <pe...@elem.com> wrote:
> On Fri, 2004-03-12 at 16:11, Mark Stosberg wrote:
>> I'm out of any ideas. Any wild guesses appreciated. :) 
>
> Your CGI::Session object is not going out of scope, so it doesn't get
> destroyed until you shut down the server.

You are so incredibly right! I added this to my teardown method, and it
appears to fix things:

if ($self->param('ses')) {
  my $session = $self->param('ses');
  $session->flush();
}

And now my tests pass. Thanks!

	Mark

-- 
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   mark@summersault.com     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp1] debugging: DBI commits delayed until server shutduwn

Posted by Perrin Harkins <pe...@elem.com>.
On Fri, 2004-03-12 at 16:11, Mark Stosberg wrote:
> I'm out of any ideas. Any wild guesses appreciated. :) 

Your CGI::Session object is not going out of scope, so it doesn't get
destroyed until you shut down the server.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html