perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Silevitch <>
Subject Re: Disconnect database connection after idle timeout
Date Thu, 13 Nov 2014 04:53:28 GMT
I don't fully understand your need here.  I'm going to give my best.

You could set an alarm in the cleanup handler that calls the disconnect
after a specified amount of time.  If a new request comes in, you could
cancel the alarm in a postreadrequest handler (or something early in the
cycle).  To cover the race condition where the disconnect happens right
before the cancel, you could check to make sure the database connection is
active right after the cancel is called.



On Wed, Nov 12, 2014 at 9:36 PM, Xinhuan Zheng <>

>  Hello,
>  I am having a database connection management question. Our
> apache+mod_perl application initiates a database connection request when it
> needs to then do data processing. Afterwards, if there is no more requests
> coming to this apache process, the database connection basically will be
> sitting there in idle state for quite a while until the OS TCP/IP idle
> timeout has reached. At that point the database would send a message into
> its alert log, telling that a connection timeout has occurred and the
> server process will be cleaned. I would like to figure out if mod_perl
> application can implement keep-alive timeout mechanism. The mod_perl would
> maintain the database connection after it finishes some processing until an
> idle timeout defined in the application has reached, for example, 5
> minutes. Then the mod_perl would initiate a database disconnection request
> so the server process can be cleaned more gracefully. We are using Oracle
> 11g database. I knew in 11G oracle has implemented the connection pooling.
> I would think the oracle side connection pooling would be the server side
> maintaining the connection idle timeout. Would it be possible on the client
> side the mod_perl implement something like that? I just don’t know which
> side is more appropriate and how on the client side it can implement
> something like that.
>  Thanks,
> - xinhuan

View raw message