您的位置:首页 > 大数据 > 人工智能

Waiting 180 more seconds for 1 worker threads to finish

2013-07-02 09:50 399 查看
Apache 的各种报错及配置优化

事件类型: 错误

事件来源: 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。
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所占用的系统资源持续增长。
具体来说,Apache的子进程在结束当前请求之前会首先将所有的并发线程进行关闭,在关闭的时候会等待3分钟,如果3分钟之内没有将所有的线程关 闭则会抛出上述的错误提示,然后强制关闭。
这样就造成了内存溢出,时间一长会使得Apache所占用资源持续增长直到无法工作。这个时候可以适当将MaxRequestsPerChild的值降低,使得Apache子进程所并发的线程数量减少,从而降低该错误出现的几率。
但是这种方式并不能彻底解决问题,幸好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:8082
MatchExpression *.jsp
MatchExpression *.do
MatchExpression *.com
MatchExpression /J/*
MatchExpression /j/*
MatchExpression /C/*
MatchExpression /c/*
MatchExpression /pra/*
MatchExpression /P/*
MatchExpression /p/*
MatchExpression /FCKeditor/*
DynamicServerList OFF
KeepAliveEnabled ON
KeepAliveSecs 30
</IfModule>
</VirtualHost>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐