本文介绍了PHP ODBC 不关闭连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 ODBC 函数访问数据库的 PHP 应用程序.我的 DBA 最近发现该应用程序没有关闭其数据库连接,导致大量无效连接处于 TIME_WAIT 状态.

I have a PHP application that uses the ODBC functions for database access. My DBA recently discovered that the application is not closings its database connections, resulting in numerous invalid connections that are in a TIME_WAIT state.

我们已经检查了代码,我正在每个脚本中调用 odbc_close_all ,另外,即使我没有调用,连接也应该在脚本结束时关闭.没有长时间运行的脚本保持它们的连接

We have checked the code and I am doing an odbc_close_all call in every script, plus even if I wasn't then the connection should close at the end of the script anyway. There are no long running scripts holding on to their connections

有没有人见过这样的事情或知道可能是什么问题?

Has anyone seen anything like this or have any idea what the issue might be?

PHP 版本为 5.1.4在 Windows Server 2003 R2 Service Pack 2 上运行MySQL 数据库

PHP version is 5.1.4Running on Windows Server 2003 R2 Service Pack 2MySQL database

推荐答案

经过大量研究,我们偶然发现了几个表明问题是 TcpTimedWaitDelay 的来源(感谢 VolkerK 的提示).这有很大帮助,但在任何给定时间,我们仍会看到大约 30-40 个连接处于 TIME_WAIT 状态.

After much research, we stumbled upon several sources that indicated that the issue was TcpTimedWaitDelay (thanks VolkerK for the tip). This has helped a good deal, but we are still seeing about 30-40 connections in the TIME_WAIT state at any given time.

我们现在想知道是否有人对这种行为对于 Windows Server 是否正常以及是否已经达到最佳状态有任何建议,或者是否还有其他值得研究的途径.

We are wondering now if anyone has any advice as to whether this behaviour is normal for a Windows Server and if this is as good as it gets, or if there are other avenues worth researching.

谢谢

这篇关于PHP ODBC 不关闭连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 13:18
查看更多