| Bug #1222 | Connection is not closed properly (mysql_close) | ||
|---|---|---|---|
| Submitted: | 8 Sep 2003 7:20 | Modified: | 23 Oct 2008 9:50 |
| Reporter: | Dmitry Arefiev | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 4.0.14b, 5.0.67 | OS: | Windows (Windows 2000) |
| Assigned to: | CPU Architecture: | Any | |
[10 Sep 2003 17:07]
MySQL Verification Team
Please do a test with the recent 4.0.15 release. From this version was fixed the Windows TCP/IP wait_timeout using socket timeouts.
[14 Feb 2005 22:54]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[12 Sep 2008 18:21]
Karl Hoener
I have just loaded MySQL 5.0.67 on a Win 2008 server and am experiencing exactly this problem. I am running a web server using MySQL for the data and the connections do not close after the page is finished loading. I have ported the same code which works properly in Win 2K and Win XP.
[13 Sep 2008 16:07]
Tonci Grgin
Dmitry, Karl, we will look into this again.
[23 Sep 2008 9:50]
Sveta Smirnova
Karl, thank you for the feedback. Which scripting language and web server do you use?
[23 Oct 2008 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".

Description: Configuration: ---------------- - MySQL client and server runs on the same machine; - machine has Win2K Pro; - is used my own MySQL Delphi data access components. Testing: ---------------- I have performed simple test. Run 10 threads. Each thread Open/Close connection 100 times. Each connection uses 2 TCP/IP connections. After closing MySQL connection remains 2 TCP/IP connections in state TIME_WAIT. So, after each test run i have 2000 of TCP/IP connections in state TIME_WAIT. After 2 test runs i have 4000 TCP/IP connections in state TIME_WAIT. That is maximum allowed number of used ports in my Win2K. So, when i run test 3d time, i will get message 'Can't connect to MySQL server on 'localhost' (10048)'. 10048 means no more free ports. After 240 sec each TCP/IP connection is TIME_WAIT state will be freed. And test runs again well. How to repeat: See description for details. Suggested fix: int vio_close(Vio * vio) { int r; char buff[10000]; ////// added this line ............... else if (vio->type != VIO_CLOSED) #endif /* _WIN_ */ { while((r=recv(vio->sd, buff, 10000, 0)) > 0); ////// added this line r=0; if (shutdown(vio->sd,2)) r= -1; if (closesocket(vio->sd)) r= -1; ...............