|go ahead... be a heretic|
DBI - cursors left open in Oracleby Stegalex (Chaplain)
|on Sep 08, 2001 at 22:30 UTC||Need Help??|
Stegalex has asked for the
wisdom of the Perl Monks concerning the following question:
I have had a persistent problem for a while with my httpd daemons consuming all my box's memory and CPU after a couple of hours. Now most people will say that this is normal, httpd sucks memory and you can't always believe what top says. However, site performance slows down and some programs die from memory starvation, so this is far from an OK thing.
After much research, I have pinpointed the problem to one lousy sql statement that sometimes inexplicably leaves a cursor opened in Oracle. When this happens, the httpd process it is running under bloats and starts sucking CPU and doesn't stop until I restart httpd.
I am certain that there is not a logic error in my code. The cursors are SPORADICALLY left open even though the cursor is closed unconditionally after it's no longer needed.
Before I go much further, here's the info about my setup.
RH Linux 7
Has anyone else encountered situations where doing an $sth->finish; doesn't work?
I know the cursors are being left open because I have examined the sql_text column in the v$open_cursors view in oracle and it shows me the statement that has the open cursor. When I kill the offending httpd process, the cursor gets closed.