Re: PHP + Oracle + OCIPLogon

From: Date: Thu, 21 Jun 2001 18:32:31 +0000
Subject: Re: PHP + Oracle + OCIPLogon
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-54782@lists.php.net to get a copy of this message
"Thies C. Arntzen" wrote: > > On Thu, Jun 21, 2001 at 03:19:09PM +0300, Rouvas Stathis wrote: > > > > Unfortunately, you are not doing anything wrong. > > Persistent connections and PHP/Ora do not play well with each other. > > ??? - please elaborate. PHP/Ora without persistent connections are fine and rock solid even under heavy load. PHP/Ora with persitent connections does not work. Explanation. Using OciPlogon you connect to Ora and everything is fine. Then you issue an OciLogout and you terminate your connection as fas as PHP is concerned. Unfortunately, the connection to Oracle is not closed, as a "ps -ef | grep oracle" can tell you. Next time PHP is called, OciPlogon requests (and gets) a new connection to Oracle without using the old one or closing it. Then OciLogout is called and you are now left with two open connections to Oracle. The connections PHP opens will timeout eventually and close "by themselves". Now, if you are testing on a personal machine or your machine has enough resources, this problem (that I call "lingering connections") may pass unnoticed. The moment you get more than about 10 hits, those "lingering connections" will add up and pretty soon you will (a) run out of Ora cursors or (b) run out of resources. When that moment comes you will not be able to connect to Ora anymore, untill some of those connections die, which of course is dependant on the timeout. Now in development server with 1GB of RAM (Solaris/Ora.8.0.4.EE/PHP.4.0.3.pl1) the "lingering connections" phenomenon rarely manifestated itself. In fact it was so rare that I almost always suspected my code doing something nasty. When it was moved into production (in a Suse Linux.2.2.14/PHP.4.0.3.pl1/Ora.8.0.5.EE) with only 128MB of RAM, upon the first test run it blew into my face. After changing all OciPlogon into plain OciLogon, all problems dissapeared. This has happened with other applications that I have experimented with. The "lingering connections" problem is with us at least since PHP.3.0.12 (which the first version of PHP I tried). That's why I say that PHP/Ora with *persistent* connection do not play well with each other. I hoped I cleared the issue. I really hope that this problem is resolved, since I expect an increase in performance when the penalty for making a new connection is avoided. -Stathis. > > tc

« previous php.general (#54782) next »