Hi,

I have an interesting (a.k.a. frustrating) problem on MySQL 4.1.11.

I try to connect to the database via DBD::mysql. Everything works - except in a 
few cases (once in every 10000 occasions, approximately) I get:

DBI connect('database=test:host=192.168.0.200','test',...) failed: Can't 
connect to MySQL server on '192.168.0.200' (99) at con.pl line 14

perror 99 gives me:
OS error code  99:  Cannot assign requested address

This doesn't make sense to me. I wrote a test script that looks like this:


for (1..50000) {
    $dbh = DBI->connect($dsn, $user, $password, {'RaiseError' => 1} );
    my $sth = $dbh->prepare('SELECT * FROM users');
}


Periodically I get the above error.

I have tried to be more nice, after upgrading DBD and DBI, etc.:

for (1..50000) {
     $dbh = DBI->connect($dsn, $user, $password, {'RaiseError' => 1} );
     my $sth = $dbh->prepare('SELECT * FROM users');
     $sth = undef;
     $dbh->disconnect;
     $dbh = undef;
}


But the same happens.


Then I straced the program. This is what I got:

restart_syscall(<... resuming interrupted call ...>) = 0
time(NULL)                              = 1170758829
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
fcntl64(3, F_SETFL, O_RDONLY)           = 0
fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), 
sin_addr=inet_addr("192.168.0.200")}, 16) = -1 EADDRNOTAVAIL (Cannot assign 
requested address)
shutdown(3, 2 /* send and receive */)   = -1 ENOTCONN (Transport endpoint is 
not connected)
close(3)                                = 0
write(1, "Doesn\'t work. Reconnecting in 1 "..., 51) = 51
time(NULL)                              = 1170758829
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0})               = 0
time(NULL)                              = 1170758830
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
fcntl64(3, F_SETFL, O_RDONLY)           = 0
fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)
connect(3, {sa_family=AF_INET, sin_port=htons(3306), 
sin_addr=inet_addr("192.168.0.200")}, 16) = -1 EADDRNOTAVAIL (Cannot assign 
requested address)
shutdown(3, 2 /* send and receive */)   = -1 ENOTCONN (Transport endpoint is 
not connected)



Anybody seen anything like this?


- Fagzal


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to