| Bug #75778 | valgrind error if ipv6 is not supported | ||
|---|---|---|---|
| Submitted: | 5 Feb 2015 1:24 | Modified: | 6 Apr 2015 12:58 |
| Reporter: | zhai weixiang (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Connection Handling | Severity: | S3 (Non-critical) |
| Version: | 5.6, 5.6.23 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[9 Feb 2015 10:35]
MySQL Verification Team
Hello Zhai, Thank you for the report and contribution. Thanks, Umesh
[9 Feb 2015 10:37]
MySQL Verification Team
test results
Attachment: 75778.txt (text/plain), 9.51 KiB.
[6 Apr 2015 12:58]
Paul DuBois
Noted in 5.8.0 changelog. mysqld could attempt to close an invalid socket file descriptor. Thanks to Zhai Weixiang for the patch.

Description: If ipv6 is not supported, a error reported in error log while using valgrind : ==13712== Warning: invalid file descriptor -1 in syscall close() related code : in function network_init 2308 bool ipv6_available= false; 2309 2310 if (!getaddrinfo(ipv6_all_addresses, port_buf, &hints, &ai)) 2311 { 2312 /* 2313 IPv6 might be available (the system might be able to resolve an IPv6 2314 address, but not be able to create an IPv6-socket). Try to create a 2315 dummy IPv6-socket. Do not instrument that socket by P_S. 2316 */ 2317 2318 MYSQL_SOCKET s= mysql_socket_socket(0, AF_INET6, SOCK_STREAM, 0); 2319 2320 ipv6_available= mysql_socket_getfd(s) != INVALID_SOCKET; 2321 2322 mysql_socket_close(s); 2323 } How to repeat: read the code Suggested fix: don't close the socket if the socket fd is invalid. for example: Index: sql/mysqld.cc =================================================================== --- sql/mysqld.cc (revision 7143) +++ sql/mysqld.cc (working copy) @@ -2319,7 +2319,8 @@ ipv6_available= mysql_socket_getfd(s) != INVALID_SOCKET; - mysql_socket_close(s); + if (ipv6_available) + mysql_socket_close(s); } if (ipv6_available)