| Bug #34381 | Client applications cannot connect to server on Vista | ||
|---|---|---|---|
| Submitted: | 7 Feb 2008 14:33 | Modified: | 11 Aug 2009 17:28 |
| Reporter: | Chuck Bell | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S1 (Critical) |
| Version: | 6.0.5 | OS: | Windows (Vista Business) |
| Assigned to: | Vladislav Vaintroub | CPU Architecture: | Any |
[7 Feb 2008 18:22]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/41881 ChangeSet@1.2536, 2008-02-07 19:19:32+01:00, vvaintroub@wva. +2 -0 BUG#34381- Client application cannot connect to server on Vista. The problem was that the server is creating an IPv6 socket and listens to IPv6-only traffic. If an older client application tries to connect server using IPv4 address (like 127.0.0.1 for local host), it fails. The solution is to clear IPV6_V6ONLY socket option before bind() - in this case we'll have dual-mode socket that accepts both IPv4 and IPv6 traffic.
[7 Feb 2008 18:58]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/41887 ChangeSet@1.2536, 2008-02-07 19:58:16+01:00, vvaintroub@wva. +2 -0 BUG#34381- Client application cannot connect to server on Vista. The problem was that the server is creating an IPv6 socket and listens to IPv6-only traffic. If an older client application tries to connect server using IPv4 address (like 127.0.0.1 for local host), it fails. The solution is to clear IPV6_V6ONLY socket option before bind() - in this case we'll have dual-mode socket that accepts both IPv4 and IPv6 traffic.
[8 Feb 2008 19:48]
Chuck Bell
Patch approved.
[12 Feb 2008 12:48]
Vladislav Vaintroub
Patch approved by Magnus via email The latest commit is http://lists.mysql.com/commits/42103
[25 Feb 2008 20:19]
Bugs System
Pushed into 6.0.5-alpha
[3 Mar 2008 18:19]
Bugs System
Pushed into 6.0.5-alpha
[3 Mar 2008 20:21]
Paul DuBois
Noted in 6.0.5 changelog. Client applications could not connect to the server on Windows Vista because the server was creating an IPv6-only TCP/IP socket.
[11 Aug 2009 9:46]
Vladislav Vaintroub
Would it be possible to mention in documentation that support for IPv6 on XP is limited. Because of restrictions of the OS (no dual stack) server listens on either IPv4 or IPv6. In Vista and later, server listens on both.
[11 Aug 2009 17:26]
Paul DuBois
Revised changelog entry: Client applications could not connect to the server on Windows Vista because the server was creating an IPv6-only TCP/IP socket. Now on Vista, the server listens on both IPv4 and IPv6. On XP, because of OS restrictions (no dual stack), the server listens on either IPv4 or IPv6.
[30 Sep 2010 5:13]
David Bergeron
I just added the line "bind-address=127.0.0.1" in the my.ini file under [mysqld] tag.

Description: The mysql client applications cannot connect to the server in the latest mysql-6.0 clone. As a result, the test suite does not connect and eventually timesout. Cannot run tests on Vista. The server starts but the clients fail to connect with messages similar to: D:\source\c++\mysql-6.0_BUG_34298\client\debug>mysqladmin -uroot shutdown mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to MySQL server on 'localhost' (10061)' Check that mysqld is running on localhost and that the port is 3306. You can check this by doing 'telnet localhost 3306' The output of netstat shows that mysqld is listening on the IPv6 wildcard address: TCP [::]:9306 [::]:0 LISTENING 940 ...which indicates the server is communicating using IPv6 only while the dump of the client applications who they are communicating using IPv4. These problems seem to be isolated to Vista as it does not appear on XP. How to repeat: clone mysql-6.0 build on Windows Vista run ./mysql-test-run.pl Suggested fix: Patch the server to communicate on both IPv6 and IPv4. Sample patch: ===== sql/mysqld.cc 1.647 vs edited ===== --- 1.647/sql/mysqld.cc 2008-01-29 02:50:45 -05:00 +++ edited/sql/mysqld.cc 2008-02-07 08:38:57 -05:00 @@ -1657,7 +1657,19 @@ user to open two mysqld servers with the same TCP/IP port. */ (void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg)); -#endif /* __WIN__ */ +#else /* __WIN__ */ +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 27 +#endif + /* + For interoperability with older clients, listen on both IPv6 and IPv4 + wildcard addresses + */ + arg = 0; + if (ai->ai_family == AF_INET6) + (void) setsockopt(ip_sock,IPPROTO_IPV6,IPV6_V6ONLY,(char*)&arg,sizeof(a rg)); + +#endif /* Sometimes the port is not released fast enough when stopping and restarting the server. This happens quite often with the test suite