I'm getting some really strange errors. I have a
CGI::Application subclass that is a superclass for other, more specific CGI::App's. After a large number of tests (page reloads, etc.), I'll get an interal service error with the following log:
DBI connect('database','username',...) failed: Too many connections
Here is the relavent code in the class:
sub cgiapp_init {
my $self = shift;
# ...some unrelated code...
my $dbh = DBI->connect('dbi:mysql:database', 'user', 'password',
{ RaiseError => 1 } ) or die $DBI::errstr;
# ...more code...
$self->param('dbh' => $dbh);
}
sub teardown {
my $self = shift;
$self->param('dbh')->disconnect() or die $self->param('dbh')->errs
+tr;
}
The subclasses do not redefine
cgiapp_init or
teardown, and I can
die in the teardown method, so I know it's getting to it. But apparently it's not disconnecting for some reason, unless somebody has any ideas on where else the problem might be. I've tried this with and without
Apache::DBI.
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.