Hi,

We have been stuck with a CGI script that is tracking clickthrus, and my
first impulse to deal with this problem is to just use mod_perl and a
persistent connection with Apache::DBI, but we don't have that choice right
now. What is happening is the script, which has to connect to a remote
database, again, not my choice, periodicly has connection failures. But
these failures are of a very random, but regular nature. The database
server, load is small for what it can handle, mysql on that server is
running at most 24 threads out of a possible 200, and the load is .10. 
The latency to the db server is about 150ms on avg. 

So the problem 

DBI->connect(affiliate_program;hostname=xxx.xxx.xxx.xxx
;mysql_connect_timeout=10) failed: Can't connect to MySQL server on
'xxx.xxx.xxx.xxx' (113) at
/usr/local/lib/perl5/site_perl/5.6.1/mod_db_connect.pm line 57
can't connect: Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (113)\

That will repeat for about 30 seconds, then go away. I tried using the
mysq_connect_timeout which is listed in the DBD::mysql docs, but I can't
find what the default timeout would be. My guess is that for some reason the
connect is taking longer than normal, but the script is giving up too quickly.
The DB server is VERY reliable and we have tested that it won't drop of the
face of the earth everyonce in a while like you will find with some hosting
companies. 

I am just lost and can't seem to find the tools I need to debug this. I even
did grep -R on the DBI and DBD::mysql dirs for (113) hoping to find some
explaination of that code. Can't find one. I admit, that for a very long
time I have used DBI and it just seems to work, and work great. But now I am
wondering, where is the documentation? I know there must be more, but the
dbi.perl.org page, doesn't seem to contain much, beyond the very basic. And
when I do searches, often I only find error logs with stuff like the above :) 

mod_db_connect contains this sub


sub db_connect_rack {
        require DBI;
        my $dbname =
"DBI:mysql:dbname;hostname=xxx.xxx.xxx.xxx;mysql_connect_timeout=10";
        my ($dbuser, $dbpasswd) = ('user', 'pass');
        my $dbh = DBI->connect($dbname, $dbuser, $dbpasswd) or die "can't
connect: $DBI::errstr\n";
        return $dbh;
}


The mysql_connect_timeout was an attempt to solve the problem, it was
happening before that. It doesn't seem to have had any effect.

I don't know if it matters, but we are running perl 5.6.1 on FreeBSD 4.7
with mysql 4.0.12 on the remote server. 



Thanks,

Eric 

(250) 655 - 9513 (PST Time Zone)

"Inquiry is fatal to certainty." -- Will Durant 




Reply via email to