Hanging Apache && Oracle Sessions with Apache::DBI, Apache::SessionManager, Oracle 9i,

[prev] [thread] [next] [Date index for 2004/12/07]

From: Tyler Rorabaugh
Subject: Hanging Apache && Oracle Sessions with Apache::DBI, Apache::SessionManager, Oracle 9i,
Date: 16:05 on 07 Dec 2004
------_=_NextPart_001_01C4DC76.9AA08800
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Dear mod_perl list,
=20
Normally I would not bother the mod_perl list with=20
questions but I have a problem with Apache::DBI, Apache::SessionManager
and Apache::Sessions
regarding hanging oracle sessions.
=20
I have noticed within the=20
Apache::Session::Store::Oracle module that it uses a=20
SELECT a_session FROM sessions WHERE id =3D ? FOR UPDATE
=20
If a user clicks the stop button in their browser during a process (IE
during a session update or setting the session) and then clicks another
link
this will sometimes cause apache to hang and the user must restart their
browser. This will also cause the previous update=20
(UPDATE sessions SET a_session =3D ? WHERE id =3D ?) Oracle session to =
hang
within Oracle. Has anyone else on the list seen this problem?
=20
Version Numbers:=20
mod_perl 1.27
Apache::DBI 0.88
Apache::SessionManager =3D 1.01
Apache::Session 1.54
DBI 1.40
DBD::Oracle 1.12
=20
=20
Current httpd.conf Apache::SessionManager setup
=20
PerlModule Apache::DBI
PerlRequire conf/startup.pl

#oracle client environment variables
SetEnv ORACLE_BASE /path/to/o01/oracle/app
SetEnv ORACLE_HOME /path/to/o01/oracle/app
SetEnv LD_LIBRARY_PATH /path/to/o01/oracle/app/lib

PerlSetEnv ORACLE_HOME /path/to/o01/oracle/app
PerlModule Apache::SessionManager
PerlTransHandler Apache::SessionManager
=20
<LocationMatch /.*/somedirectory/.*>
PerlSetVar SessionManagerTracking On
#PerlSetVar SessionManagerURITracking On
PerlSetVar SessionManagerExpire 3600
PerlSetVar SessionManagerInactivity 900
PerlSetVar SessionManagerName SESSID
PerlSetVar SessionManagerCookieArgs "Path   =3D> /, Domain =3D>
subdomain.mydomain.com"
PerlSetVar SessionManagerStore Oracle
PerlSetVar SessionManagerStoreArgs "DataSource =3D> dbi:Oracle:mydb,
UserName  =3D> *, Password   =3D> *, LongReadLen =3D> 24576, Commit =3D> =
1"
PerlSetVar SessionManagerDebug 9
PerlSetVar SessionManagerSetEnv On
</LocationMatch>

<Location /perl-status>
SetHandler  perl-script
PerlHandler Apache::Status
PerlSetVar StatusOptionsAll On
</Location>

=20
Inside the mod_perl application
=20
$self->{session} =3D new Apache::SessionManager($r);
=20
sub getSessionParam {
    my $self =3D shift;
    my $param =3D shift;
    return undef unless($param);
    my $s =3D $self->{session};
    my ($sparam) =3D $s->get_session_param($self->client_name);
    if(defined $sparam->{$param}) {
        return $sparam->{$param};
    } else {
        return undef;
    }
}

sub setSessionParam {
    my $self =3D shift;
    my $param =3D shift;
    my $value =3D shift;
    return undef unless($param && $value);
    my $s =3D $self->{session};
    my  ($sparam) =3D $s->get_session_param($self->client_name);
    $sparam->{$param} =3D $value;
    $s->set_session_param($self->client_name, $sparam);
    return $sparam;
}
=20
Last question
=20
Apache::DBI->setPingTimeOut($data_source, $timeout)
=20
       This configures the usage of the ping method, to validate a
connection.
       Setting the timeout to 0 will always validate the database
connection
       using the ping method (default). Setting the timeout < 0 will
de-acti-
       vate the validation of the database handle. This can be used for
       drivers, which do not implement the ping-method. Setting the
timeout >
       0 will ping the database only if the last access was more than
timeout
       seconds before.

=20
=20
Any help would be appreciated=20
=20
Sincerely Yours,
Tyler Rorabaugh
=20
=20
=20
=20
=20
=20
=20
=20
=20
=20
=20
=20
=20
=20

------_=_NextPart_001_01C4DC76.9AA08800
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D120502715-07122004>Dear =
mod_perl=20
list,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>Normally I would not=20
bother the mod_perl list with </FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>questions but I have=20
a problem with Apache::DBI, Apache::SessionManager and=20
Apache::Sessions</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>regarding hanging=20
oracle sessions.</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial size=3D2>I have =
noticed=20
within the </FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2>Apache::Session::Store::Oracle module that it uses a =
</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial size=3D2>SELECT =
a_session=20
FROM sessions WHERE id =3D ? FOR UPDATE</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial size=3D2>If a =
user clicks the=20
stop button in their browser during a process (IE during a session =
update or=20
setting the session)&nbsp;and then clicks another =
link</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial size=3D2>this =
will sometimes=20
cause apache to hang and the user must restart their browser. This will =
also=20
cause the previous update </FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>(UPDATE sessions SET=20
a_session =3D ? WHERE id =3D ?) Oracle session to hang within Oracle.=20
</FONT></SPAN><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>Has anyone=20
</FONT></SPAN><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>else on the=20
list seen this problem?</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>Version Numbers:=20
</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>mod_perl=20
1.27</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>Apache::DBI=20
0.88</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2>Apache::SessionManager =3D 1.01</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>Apache::Session=20
1.54</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial size=3D2>DBI=20
1.40<BR>DBD::Oracle 1.12</DIV></FONT></SPAN>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>Current httpd.conf=20
Apache::SessionManager setup</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>PerlModule=20
Apache::DBI</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>PerlRequire=20
conf/startup.pl<BR><BR>#oracle client environment variables<BR>SetEnv=20
ORACLE_BASE /path/to/o01/oracle/app<BR>SetEnv ORACLE_HOME=20
/path/to/o01/oracle/app<BR>SetEnv LD_LIBRARY_PATH=20
/path/to/o01/oracle/app/lib<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>PerlSetEnv ORACLE_HOME=20
/path/to/o01/oracle/app<BR>PerlModule =
Apache::SessionManager<BR>PerlTransHandler=20
Apache::SessionManager</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;LocationMatch /.*/<SPAN=20
class=3D120502715-07122004>somedirectory</SPAN>/.*&gt;<BR>PerlSetVar=20
SessionManagerTracking On<BR>#PerlSetVar SessionManagerURITracking=20
On<BR>PerlSetVar SessionManagerExpire 3600<BR>PerlSetVar=20
SessionManagerInactivity 900<BR>PerlSetVar SessionManagerName=20
SESSID<BR>PerlSetVar SessionManagerCookieArgs "Path&nbsp;&nbsp; =3D&gt; =
/, Domain=20
=3D&gt;&nbsp;<SPAN=20
class=3D120502715-07122004>subdomain.mydomain.com</SPAN>"<BR>PerlSetVar=20
SessionManagerStore Oracle<BR>PerlSetVar SessionManagerStoreArgs =
"DataSource=20
=3D&gt; dbi:Oracle:<SPAN class=3D120502715-07122004>mydb</SPAN>, =
UserName&nbsp;=20
=3D&gt;&nbsp;<SPAN class=3D120502715-07122004>*</SPAN>, =
Password&nbsp;&nbsp;=20
=3D&gt;&nbsp;<SPAN class=3D120502715-07122004>*</SPAN>, LongReadLen =
=3D&gt; 24576,=20
Commit =3D&gt; 1"<BR>PerlSetVar SessionManagerDebug 9<BR>PerlSetVar=20
SessionManagerSetEnv On<BR>&lt;/LocationMatch&gt;<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;Location =
/perl-status&gt;<BR>SetHandler&nbsp;=20
perl-script<BR>PerlHandler Apache::Status<BR>PerlSetVar StatusOptionsAll =

On<BR>&lt;/Location&gt;<BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial size=3D2>Inside =
the mod_perl=20
application</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>$self-&gt;{session}=20
=3D new Apache::SessionManager($r);</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial size=3D2>sub =
getSessionParam=20
{<BR>&nbsp;&nbsp;&nbsp; my $self =3D shift;<BR>&nbsp;&nbsp;&nbsp; my =
$param =3D=20
shift;<BR>&nbsp;&nbsp;&nbsp; return undef =
unless($param);<BR>&nbsp;&nbsp;&nbsp;=20
my $s =3D $self-&gt;{session};<BR>&nbsp;&nbsp;&nbsp; my ($sparam) =3D=20
$s-&gt;get_session_param($self-&gt;client_name);<BR>&nbsp;&nbsp;&nbsp;=20
if(defined $sparam-&gt;{$param}) =
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
return $sparam-&gt;{$param};<BR>&nbsp;&nbsp;&nbsp; } else=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return=20
undef;<BR>&nbsp;&nbsp;&nbsp; }<BR>}<BR></FONT></SPAN></DIV><SPAN=20
class=3D120502715-07122004>
<DIV><FONT face=3DArial size=3D2>sub setSessionParam =
{<BR>&nbsp;&nbsp;&nbsp; my=20
$self =3D shift;<BR>&nbsp;&nbsp;&nbsp; my $param =3D =
shift;<BR>&nbsp;&nbsp;&nbsp; my=20
$value =3D shift;<BR>&nbsp;&nbsp;&nbsp; return undef unless($param =
&amp;&amp;=20
$value);<BR>&nbsp;&nbsp;&nbsp; my $s =3D=20
$self-&gt;{session};<BR>&nbsp;&nbsp;&nbsp; my&nbsp; ($sparam) =3D=20
$s-&gt;get_session_param($self-&gt;<SPAN=20
class=3D120502715-07122004>client_name</SPAN>);<BR>&nbsp;&nbsp;&nbsp;=20
$sparam-&gt;{$param} =3D $value;<BR>&nbsp;&nbsp;&nbsp;=20
$s-&gt;set_session_param($self-&gt;<SPAN=20
class=3D120502715-07122004>client_name</SPAN>, =
$sparam);<BR>&nbsp;&nbsp;&nbsp;=20
return $sparam;<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D120502715-07122004>Last=20
question</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D120502715-07122004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D120502715-07122004>Apache::DBI-&gt;setPingTimeOut($data_source,=20
$timeout)</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D120502715-07122004>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This =
configures=20
the usage of the ping method, to validate a=20
connection.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Setting the timeout =
to 0=20
will always validate the database=20
connection<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using the ping method =

(default). Setting the timeout &lt; 0 will=20
de-acti-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vate the validation of =
the=20
database handle. This can be used =
for<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
drivers, which do not implement the ping-method. Setting the timeout=20
&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 will ping the database =
only if=20
the last access was more than =
timeout<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
seconds before.<BR></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D120502715-07122004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D120502715-07122004></SPAN></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>Any&nbsp;help would=20
be appreciated </FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial =
size=3D2>Sincerely=20
Yours,</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial size=3D2>Tyler=20
Rorabaugh</FONT></SPAN></DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2>&nbsp;</DIV></FONT></SPAN>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT></SPAN>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D120502715-07122004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV></BODY></HTML>

------_=_NextPart_001_01C4DC76.9AA08800--

(message missing)

Hanging Apache && Oracle Sessions with Apache::DBI, Apache::SessionManager, Oracle 9i,
Tyler Rorabaugh 16:05 on 07 Dec 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52