Apache error.log [warn](OS 64)指定的网络名不再可用。winnt_accept: Asynchronous AcceptEx failed.

两年前公司给客户做过一个门户网站,近些日子客户多次向我反映,网站打开网页特别慢,经常打不开网站,就是打开也要7、8分钟才能打开。后来重启服务,之后没过半小时,又是打不开网站了。

        我们用的是Apache2.2,进入 /Apache2.2/logs/ ,发现有好多error.log,打开最近日期的一个,看到日志输出了许多的“[warn](OS 64)指定的网络名不再可用。winnt_accept: Asynchronous AcceptEx failed.” 。在网上查了许多资料,解决方法简单地说就是让Apache启动时关闭AcceptEx(),我先把解决方案说一下,然后在贴上一些官方的解释。我想大家也和我一样,遇到这样的问题想最先试试解决方法。

        

        打开配置文件 / Apache2.2 / conf / httpd.conf ,找到 #Include conf/extra/httpd-mpm.conf ,然后去掉前面的#。


# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
        打开配置文件 / Apache2.2 / conf / extra / httpd-mpm.conf ,找到<IfModule mpm_winnt_module>(有的版本是<IfModule mpm_winnt.c>),

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_winnt_module>
ThreadsPerChild 1000
MaxRequestsPerChild 10000
Win32DisableAcceptEx #加入这行
</IfModule>
        Win32DisableAcceptEx 是新加入的。


        重新启动Apache,error.log不会再出现“[warn](OS 64)指定的网络名不再可用。winnt_accept: Asynchronous AcceptEx failed.”,而且页面访问速度变得很快了。

下面是就这个问题的Apache官方的解释:

http://httpd.apache.org/docs/2.0/mod/mpm_winnt.html#win32disableacceptex

=========================================================================================

Win32DisableAcceptEx Directive
Description: Use accept() rather than AcceptEx() to accept network connections
Syntax: Win32DisableAcceptEx
Default: AcceptEx() is enabled by default. Use this directive to disable use of AcceptEx()
Context: server config
Status: MPM
Module: mpm_winnt
Compatibility: Available in Version 2.0.49 and later
AcceptEx() is a Microsoft WinSock v2 API that provides some performance improvements over the use of the BSD style accept() API in certain circumstances. Some popular Windows products, typically virus scanning or virtual private network packages, have bugs that interfere with the proper operation of AcceptEx(). If you encounter an error condition like:

[error] (730038)An operation was attempted on something that is not a socket.: winnt_accept: AcceptEx failed. Attempting to recover.

you should use this directive to disable the use of AcceptEx().

=========================================================================================

大概翻译一下:

AcceptEx()默认是启用的;相关配置在mpm_winnt模块中,在2.0.49以及后面的版本就开始用了。

AcceptEx()是一个在某些情况下提高网络效率的微软的winsock v2的API。一些流行的Windows产品,尤其是病毒扫描及类似的软件会妨碍AcceptEx()的正确操作。如果你在error日志中遇到下面的输出:

[warn](OS 64)指定的网络名不再可用。winnt_accept: Asynchronous AcceptEx failed.
你应该关闭掉AcceptEx()。


//////////////////////////////////////////////////////////////////////////////////////////////////////

下面是我在查阅网上资料时看到的,他在改过配置后,发现内存猛增,一直到最后crash的情况。经过他的实验发现是,配置ThreadsPerChild 的数量与本身服务器的内存大小有一定的平衡关系。我在这里贴出他写的文章的链接,遇到类似问题的可以读一下。(尊重原创)

http://blog.csdn.net/lcj8/article/details/5767889

有什么不对的地方请大家多多指点,谢谢。
---------------------
作者:kaige_loveu
来源:CSDN
原文:https://blog.csdn.net/zwk199024/article/details/44975659
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自www.cnblogs.com/CryOnMyShoulder/p/9813906.html