summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorIngo Struewing <ingo.struewing@sun.com>2009-09-30 12:28:15 +0200
committerIngo Struewing <ingo.struewing@sun.com>2009-09-30 12:28:15 +0200
commit7dacca0ff0a3c28401500afc807b71ebe9e4594f (patch)
tree91aecbc0399d11fa12af389463f5732e9d27d62b /libmysqld
parentccae404afaddf98c16889fdd21c613b551ee5e5e (diff)
downloadmariadb-git-7dacca0ff0a3c28401500afc807b71ebe9e4594f.tar.gz
Bug#37267 - connect() EINPROGRESS failures mishandled in client library
We cann connect() in a non-blocking mode to be able to specify a non-standard timeout. The problem was that we did not fetch the status from the non-blocking connect(). We assumed that poll() would not return a POLLIN flag if the connect failed. But on some platforms this is not true. After a successful poll() we do now retrieve the status value from connect() with getsockopt(...SO_ERROR...). Now we do know if (and how) the connect failed. The test case for my investigation was rpl.rlp_ssl1 on an Ubuntu 9.04 x86_64 machine. Both, IPV4 and IPV6 were active. 'localhost' resolved first for IPV6 and then for IPV4. The connection over IPV6 was blocked. rpl.rlp_ssl1 timed out as it did not notice the failed connect(). The first read() failed, which was interpreted as a master crash and the connection was tried to reestablish with the same result until the retry limit was reached. With the fix, the connect() problem is immediately recognized, and the connect() is retried on the second resolution for 'localhost', which is successful. libmysqld/libmysqld.c: Bug#37267 - connect() EINPROGRESS failures mishandled in client library Changed a DBUG print string to distinguish the two mysql_real_connect() implementations in DBUG traces. mysql-test/include/wait_for_slave_param.inc: Bug#37267 - connect() EINPROGRESS failures mishandled in client library Made timeout value available in error message. mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result: Bug#37267 - connect() EINPROGRESS failures mishandled in client library Fixed test result. Connect error is now detected as CR_CONN_HOST_ERROR (2003) instead of CR_SERVER_LOST (2013). sql-common/client.c: Bug#37267 - connect() EINPROGRESS failures mishandled in client library Added retrieval of the error code from the non-blocking connect(). Added DBUG. Added comment.
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/libmysqld.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index aff9391e015..31ad8844650 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -99,7 +99,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
char name_buff[USERNAME_LENGTH];
DBUG_ENTER("mysql_real_connect");
- DBUG_PRINT("enter",("host: %s db: %s user: %s",
+ DBUG_PRINT("enter",("host: %s db: %s user: %s (libmysqld)",
host ? host : "(Null)",
db ? db : "(Null)",
user ? user : "(Null)"));