1. 程式人生 > >Apache error.log [warn](OS 64)指定的網路名不再可用。winnt_accept: Asynchronous AcceptEx failed.

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
版權宣告:本文為博主原創文章,轉載請附上博文連結!