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.
Apache 1.3.12
Oracle: 8.1.5.0.2
Perl 5.6.0
RH Linux 7
DBI 1.14
mod_perl 1.24
html::embperl 1.3.1
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.
Strange.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.