EvanCarroll has asked for the wisdom of the Perl Monks concerning the following question:
<%shared> ## Verfiy we have a cookie with a _session_id my $c = Apache2::Cookie->fetch($r); if ( exists $c->{'WBT_Session'} ) { $c= ($c->{'WBT_Session'}->value)[0]; } else { $m->clear_buffer; $m->subexec('/index.html', error => 201 ); $m->abort; } ## Verify we have session that matches cookies ID my %APACHE_SESSION; eval { tie %APACHE_SESSION, 'Apache::Session::Postgres', $c, { Handle => $dbh, Commit => 1, };}; if ( $@ ) { if ( $@ ) { ## No tuple with matching ID (form cookie), bogus data. $m->clear_buffer; $dbh->rollback; $m->subexec('/index.html', error => 301 ); $m->abort; } } ## Verify that the sessioned user still has an entry in the users ta +ble ## Save user information into $U by ref my $U = $dbh->selectrow_hashref( qq{ SELECT * FROM "users" WHERE pkid = ? }, {}, $APACHE_SESSION{'p +kid'} ); if ( defined $U ) { ##@@## HERE IS PROBLEM ##@@## WORKS FINE IF I DON'T SEND S ( %APACHE_SESSION REF ) ##@@## STALLS IF I SEND S! $m->call_next( S => \%APACHE_SESSION, U => $U); } else { $m->clear_buffer; $m->subexec('/index.html', error => 101 ); $m->abort; } </%shared> <%cleanup> $dbh->commit(); untie %APACHE_SESSION; </%cleanup>
The problem is in the sesion object, at first I figured this would be one thread/fork per process, so refrences would be valid, and but aparently they aren't. If I comment out the the sending of the sesion refnrece everything works fine and dandy, however If i uncomment out session refrence apache just hangs indefinitly.
anyone have any ideas on how to fix this problem, or even what it is
This prolbem is so damn weird, everything works fine if I change this:
if ( defined $U ) { $m->call_next( S => \%APACHE_SESSION, U => $U); }
if ( defined $U ) { my %APACHE_SESSION = %APACHE_SESSION; $m->call_next( S => \%APACHE_SESSION, U => $U); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Major Mod_perl/Apache2 dilema
by johnnywang (Priest) on Oct 17, 2005 at 05:49 UTC | |
by EvanCarroll (Chaplain) on Oct 17, 2005 at 09:04 UTC | |
|
Re: Major Mod_perl/Apache2 dilema
by perrin (Chancellor) on Oct 17, 2005 at 20:04 UTC | |
|
Re: Major Mod_perl/Apache2 dilema
by Anonymous Monk on Oct 17, 2005 at 08:22 UTC | |
by EvanCarroll (Chaplain) on Oct 17, 2005 at 09:08 UTC |