Waiting 180 more seconds for 1 worker threads to finish

Apache 的各類報錯及配置優化  html


事件類型: 錯誤web


事件來源: Application Error
事件種類: (100)
事件 ID: 1000
日期:   2010-1-28
事件:   14:18:53
用戶:   N/A
計算機: WEBSERVER
描述:
錯誤應用程序 Apache.exe,版本 2.0.54.0,錯誤模塊 libhttpd.dll,版本 2.0.59.200,錯誤地址 0x0001c022。apache

Waiting 150 more seconds for 1 worker threads to finish. 服務器

[Fri Mar 06 16:02:47 2009] [notice] Child 1836: Waiting 180 more seconds for 1 worker threads to finish.
[Fri Mar 06 16:03:20 2009] [notice] Child 1836: Waiting 150 more seconds for 1 worker threads to finish.
併發

上面錯誤中的數字1有多是其餘數字,形成這個錯誤的緣由是Apache在關閉併發線程的時候出現線程溢出,從而形成內存泄露,表現出來的就是Apache所佔用的系統資源持續增加。dom

具體來講,Apache的子進程在結束當前請求以前會首先將全部的併發線程進行關閉,在關閉的時候會等待3分鐘,若是3分鐘以內沒有將全部的線程關 閉則會拋出上述的錯誤提示,而後強制關閉。jsp

這樣就形成了內存溢出,時間一長會使得Apache所佔用資源持續增加直到沒法工做。這個時候能夠適當將MaxRequestsPerChild的值下降,使得Apache子進程所併發的線程數量減小,從而下降該錯誤出現的概率。ide

可是這種方式並不能完全解決問題,幸虧Apache2.0.x的最新版本(2.0.63)解決了以前版本的這個問題,若是3分鐘以內有線程沒有關閉的話會自動根據時間狀況再增長等待結束的時間直到最終將全部的線程結束。性能


mpm_winnt.c是專門針對Windows NT優化的MPM(多路處理模塊),它使用一個單獨的父進程產生一個單獨的子進程,在這個子進程中輪流產生多個線程來處理請求。也就是說mpm_winnt只能啓動父子兩個進程, 不能像Linux下那樣同時啓動多個進程。
1:ThreadsPerChild
這個參數用於設置每一個進程的線程數, 子進程在啓動時創建這些線程後就再也不創建新的線程了. 一方面由於mpm_winnt不能啓動多個進程, 因此這個數值要足夠大,以即可以處理可能的請求高峯; 另外一方面該參數以服務器的響應速度爲準的, 數目太大的反而會變慢。所以須要綜合均衡一個合理的數值。
mpm_winnt上的默認值是64, 最大值是1920. 這裏建議設置爲100-500之間,服務器性能高的話值大一些,反之值小一些。優化

2:MaxRequestsPerChild
該參數表示每一個子進程可以處理的最大請求數, 即同時間內子進程數目.設置爲零表示不限制, mpm_winnt上的默認值就是0.

官方參考手冊中不建議設置爲0, 主要基於兩點考慮: (1) 能夠防止(偶然的)內存泄漏無限進行,從而耗盡內存; (2) 給進程一個有限壽命,從而有助於當服務器負載減輕的時候減小活動進程的數量。

所以這個參數的值更大程度上取決於服務器的內存,若是內存比較大的話能夠設置爲0或很大的數字,不然設置一個小的數值。須要說明的是,若是這個值設置的過小的話會形成Apache頻繁重啓,在日誌文件中會看到以下的文字:

Process exiting because it reached MaxRequestsPerChild. Signaling the parent
這樣一來反而下降了Apache的整體性能。

3:參考設置:

<IfModule mpm_winnt.c>
 ThreadsPerChild 250
 MaxRequestsPerChild 5000
</IfModule>

2003的報錯:

錯誤應用程序 Apache.exe,版本 2.0.63.200,錯誤模塊 libhttpd.dll,版本 2.0.63.200,錯誤地址 0x0001c0a2


apache的報錯:

[Sat Mar 07 16:10:26 2009] [notice] Parent: Received restart signal -- Restarting the server.
[Sat Mar 07 16:10:26 2009] [notice] Apache/2.0.63 (Win32) configured -- resuming normal operations
[Sat Mar 07 16:10:26 2009] [notice] Server built: Jan 17 2008 22:58:29
[Sat Mar 07 16:10:26 2009] [notice] Parent: Created child process 4388
[Sat Mar 07 16:10:26 2009] [notice] Child 4388: Child process is running
[Sat Mar 07 16:10:26 2009] [notice] Child 3356: Exit event signaled. Child process is ending.
[Sat Mar 07 16:10:26 2009] [warn] (OS 10038)在一個非套接字上嘗試了一個操做。  : setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed.
[Sat Mar 07 16:10:27 2009] [notice] Child 3356: Released the start mutex
[Sat Mar 07 16:10:27 2009] [notice] Child 4388: Acquired the start mutex.
[Sat Mar 07 16:10:27 2009] [notice] Child 4388: Starting 250 worker threads.
[Sat Mar 07 16:10:28 2009] [notice] Child 3356: Terminating 121 threads that failed to exit.

apache設置:

LoadModule weblogic_module modules/mod_wl_20.so
# 虛擬主機--主站
<VirtualHost *:80>
ServerAdmin
DirectoryIndex index.html
DocumentRoot E:\bea\user_projects\domains\
ServerName www.getingbin.org ServerAlias getingbin.org ErrorLog E:\log\web\apache\error_log CustomLog E:\log\web\apache\access_log common<IfModule mod_weblogic.c> WebLogicCluster 127.0.0.1:8081,127.0.0.1:8082MatchExpression *.jsp MatchExpression *.doMatchExpression *.comMatchExpression /J/*MatchExpression /j/*MatchExpression /C/*MatchExpression /c/*MatchExpression /pra/*MatchExpression /P/*MatchExpression /p/*MatchExpression /FCKeditor/*DynamicServerList OFFKeepAliveEnabled ONKeepAliveSecs 30 </IfModule></VirtualHost>

相關文章
相關標籤/搜索