Bug #64333 libmysqlclient returns not ETIMEDOUT but EINTR when timeout occurs
| Submitted: | 15 Feb 2012 1:50 | Modified: | 15 Feb 2012 17:01 |
|---|---|---|---|
| Reporter: | Sadao Hiratsuka (Basic Quality Contributor) | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: C API (client library) | Severity: | S3 (Non-critical) |
| Version: | 5.5.20 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any |
[15 Feb 2012 17:01]
Sveta Smirnova
Thank you for the report. Verified as described. This is fixed in 5.6, but as I seen no bug report for this still setting this as "Verified"
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: libmysqlclient returns not ETIMEDOUT but EINTR when timeout occurs. Affected version : 4.0 - 5.5 How to repeat: <conn.c> int main() { int timeout = 5; MYSQL *mysql; printf("connecting...\n"); mysql = mysql_init(NULL); mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (const char *) &timeout); if (mysql_real_connect(mysql, "<some unreachable address>", "<...>", "<...>", "<...>", 3306, NULL, 0)) { printf("success.\n"); mysql_close(mysql); } else { printf("error: %s\n", mysql_error(mysql)); } } <example> $ ./conn connecting... error: Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (4) $ perror 4 OS error code 4: Interrupted system call Suggested fix: I think libmysqlclient should return ETIMEDOUT instead of EINTR. *** sql-common/client.c_org 2012-02-15 10:50:24.000000000 +0900 --- sql-common/client.c 2012-02-15 10:50:39.000000000 +0900 *************** *** 211,217 **** if (!(res= poll(&ufds, 1, (int) timeout*1000))) { DBUG_PRINT("info", ("poll timed out")); ! errno= EINTR; DBUG_RETURN(-1); } DBUG_PRINT("info", --- 211,217 ---- if (!(res= poll(&ufds, 1, (int) timeout*1000))) { DBUG_PRINT("info", ("poll timed out")); ! errno= ETIMEDOUT; DBUG_RETURN(-1); } DBUG_PRINT("info", <example> $ ./conn connecting... error: Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (110) $ perror 110 OS error code 110: Connection timed out