Bonjour,
I've some problems with mysql_ping() in the C library. I wrote a
little program which job is only to connect to a Mysql server and
then to loop :
for (;;) {
sleep (5);
printf ("mysql_ping : %d\n",mysql_ping(&mysql));
}
The output of the program :
mysql_ping : 0
mysql_ping : 0
mysql_ping : 0
mysql_ping : 0
...
Then I change the default gateway in my route table to another
gateway to the Internet of my local network.
With the new gateway, I'm able to ping the Mysql server without
problem. So thing should be ok too for the Mysql connection.
But the program doesn't print anything anymore. It seems that
mysql_ping() doesn't return.
Even if the modification of the default gateway breaks the mysql
connection, I was expecting mysql_ping to re-establish it, but it
doesn't work even if waiting for a while.
When setting the default gateway back to the first one, then the
mysql_ping returns and the
mysql_ping : 0
...
are back.
When stracing the program, it seems that the system returns for a
read system call a 'eagain' error. Then there's a loop on the read
system call ... which seems to be infinite.
Shouldn't there be a timeout or a limit in tries which if reached
considers the connection as broken and that a reconnect is needed ?
I have this problem on Linux 2.0.36 and Mysql 3.22.21 .
Regards,
Alex.