Bug #98911 | MDL system become insane after 64K connections | ||
---|---|---|---|
Submitted: | 11 Mar 2020 14:44 | Modified: | 9 Apr 2020 0:56 |
Reporter: | Fungo Wang (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Connection Handling | Severity: | S1 (Critical) |
Version: | 5.7.29 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | 64K, hash pins, lf_hash, mdl |
[11 Mar 2020 14:44]
Fungo Wang
[11 Mar 2020 15:32]
MySQL Verification Team
Hi Mr. Wang, Thank you for your bug report. I agree with your findings, although most OSs have a limit of 64 K handles on the single socket. Verified as reported for 5.7.
[11 Mar 2020 15:33]
MySQL Verification Team
This is the same as bug #98624, but it is regarding MySQL 5.7.
[12 Mar 2020 1:34]
Fungo Wang
Hi Sinisa, Thanks for your quick verified. 1. This bug in 5.7 has noting to do with connection handing, so I don't know why you put it under "MySQL Server: Connection Handling" category. 2. > "although most OSs have a limit of 64 K handles on the single socket." I guess you misunderstand the socket limitation in modern linux OS. And probably, the limitation what you said, is at the client side. At client side, every socket is allocated n unique port number to connect mysql-server:3306, and this port number is limited to 64K (16bit), because the limitation of TCP protocol. Ant the real avaliable local port range is decidec by net.ipv4.ip_local_port_range. *BUT* this has nothing to do at the mysql-server:3306 side, there is only one port number needed for mysql-server, and the the socket number mysql-server:3306 could handled is not limited to 64K. You may check the answers here https://stackoverflow.com/questions/11129212/tcp-can-two-different-sockets-share-a-port. And actually it's not that hard to establish around 100K connections using 2 client boxes, this is one of my local testing mysqld, and I creating new connections using to client: `show global status like 'Threads_connected'` per sec Thu Mar 12 09:24:51 CST 2020 Threads_connected 0 Thu Mar 12 09:24:52 CST 2020 Threads_connected 3186 Thu Mar 12 09:24:53 CST 2020 Threads_connected 9461 Thu Mar 12 09:24:54 CST 2020 Threads_connected 15669 Thu Mar 12 09:24:55 CST 2020 Threads_connected 21950 Thu Mar 12 09:24:56 CST 2020 Threads_connected 28228 Thu Mar 12 09:24:57 CST 2020 Threads_connected 34499 Thu Mar 12 09:24:58 CST 2020 Threads_connected 40776 Thu Mar 12 09:24:59 CST 2020 Threads_connected 47069 Thu Mar 12 09:25:00 CST 2020 Threads_connected 50001 Thu Mar 12 09:25:01 CST 2020 Threads_connected 53298 Thu Mar 12 09:25:02 CST 2020 Threads_connected 58983 Thu Mar 12 09:25:03 CST 2020 Threads_connected 64652 Thu Mar 12 09:25:04 CST 2020 Threads_connected 70298 Thu Mar 12 09:25:05 CST 2020 Threads_connected 75935 Thu Mar 12 09:25:06 CST 2020 Threads_connected 81589 Thu Mar 12 09:25:07 CST 2020 Threads_connected 87286 Thu Mar 12 09:25:08 CST 2020 Threads_connected 92838 Thu Mar 12 09:25:09 CST 2020 Threads_connected 95002 So I may wonder that have you guys really tried to repro this bug, using more than 64K connections?Pls try it. 3. As this can lead to wrong data result, for a database product, this is totally unacceptable. It's much more severe than deny-of-service (crash, hang, flutter etc.) !!! So I guess S1 is a reasonable bug level for 5.7.
[12 Mar 2020 13:08]
MySQL Verification Team
Hi Mr. Wang, Thank you for your contribution.
[8 Apr 2020 18:04]
Paul DuBois
Posted by developer: Fixed in 8.0.21. Pinbox exhaustion in the metadata locking subsystem could produce a misleading error message.
[9 Apr 2020 0:56]
Fungo Wang
Hi Paul, This bug is for 5.7, and there is no misleading err msg, but unexpected data result. Maybe bug #98624, aimed for 8.0 and emit misleading err msg at connect, is the one should be closed. Thanks.
[9 Apr 2020 12:37]
MySQL Verification Team
Thank you, Paul .....