Bug #67231 use mysql_real_connect to be held with no return value
| Submitted: | 15 Oct 2012 9:10 | Modified: | 18 Dec 2012 2:33 |
|---|---|---|---|
| Reporter: | Jack Lee | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: C API (client library) | Severity: | S3 (Non-critical) |
| Version: | 5.0.95, 5.1.67, 5.5.30, 5.7.0 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | mysql_real_connect connect timeout | ||
[6 Dec 2012 19:27]
Sveta Smirnova
Thank you for the report. Verified as described: [sveta@delly bugs]$ time ./bug67231 NULL real 3m9.392s user 0m0.001s sys 0m0.003s Setting option connect_timeout for client and MYSQL_OPT_CONNECT_TIMEOUT do not help.
[18 Dec 2012 2:33]
Jack Lee
How is the bug now? Is there any progress?
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 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: When i use mysql_real_connect to connect to a unaccessiable IP address, it won't return How to repeat: OS: SUSE Linux 3.0.13 MySQL: 5.0.95 The code for connect is below: #include <mysql.h> void main(){ MYSQL *dbHandle = NULL; char dbHost[] = "192.17.252.120"; /* The Intranet segment is 172.17.xxx.xxx */ char dbUser[] = "dbtest"; char dbPass[] = "123"; char dbName[] = "test"; dbHandle = mysql_init(NULL); if (NULL == dbHandle){ /* error process */ } dbHandle = mysql_real_connect(dbHandle, , dbUser, dbPass, dbName, 0, NULL, 0); if (NULL == dbHandle){ /* error process */ } /* other process */ } Run the code above, it will stop at mysql_real_connect and hold there over 10 minutes. But if you change the dbHost to "172.17.254.241" which is in Intranet but unaccessible, then the program will only stop at mysql_real_connect for about 20 seconds Suggested fix: PS: But on Windows XP and MySQL 5.5.28, no matter whether the ip is 172.17.254.241 or 192.17.252.120, no matter the unaccessible ip address is in Intranet or not, the mysql_real_connect will return in 20 seconds with error information below: error: Can't connect to MySQL server on 'xx.xx.xx.xx' (10060) errno: 2003 sqlState:HY000 Is this problem related to MySQL version? Version 5.0.95 maybe too old and the problem has been fixed in later version?