Apache 停止处理请求 (mod_wsgi?) [英] Apache stops processing requests (mod_wsgi?)
问题描述
在某些时候,我的站点在带有 mod_wsgi 的 Apache2 上运行只是停止处理请求.与服务器的连接被维护,客户端等待响应,但它永远不会被 apache 返回.此时的服务器 CPU 使用率为 0%,没有任何处理.我认为,apache 只是将请求发送到队列,而永远不会将它们从那里取出.当我执行 apache2ctl graceful
时,问题没有解决.只有在apache2ctl restart
之后.
At some point my site, running on Apache2 with mod_wsgi just stops processing requests. The connection to server is maintained and client waits for responce, but it never is returned by apache. The server at this time is at 0% CPU, and nothing is processing. I think, apache just sends request to queue and never gets them out of there.
When I perform apache2ctl graceful
the problem does not resolve. Only after apache2ctl restart
.
我的站点是 Pyramid 的 4 个实例 wsgi 应用程序和 Zope 3 的 2 个实例.它运行正常并且没有速度问题,我知道.
My site is a 4 instance wsgi application of Pyramid and 2 instances of Zope 3. It is running normaly and does not have speed problems, that I am aware of.
版本:Ubuntu 10.04apache2 2.2.14-5ubuntu8.9libapache2-mod-wsgi 2.8-2ubuntu1
versions: Ubuntu 10.04 apache2 2.2.14-5ubuntu8.9 libapache2-mod-wsgi 2.8-2ubuntu1
推荐答案
听起来您正在使用嵌入式模式来运行多个应用程序,而您正在使用在子解释器中存在问题的第三方 C 扩展,从而导致潜在的死锁.否则,您的代码在内部死锁或阻塞外部服务并且永远不会返回,从而导致可用进程/线程耗尽.
Sounds like you are using embedded mode to run the multiple applications and you are using third party C extensions that have problems in sub interpreters, resulting in potential deadlock. Else your code is internally deadlocking or blocking on external services and never returning, causing exhaustion of available processes/threads.
首先,您应该考虑使用守护进程模式并将每个 Web 应用程序委托给不同的守护进程组,然后强制每个应用程序在主解释器中运行.
For a start, you should look at using daemon mode and delegate each web application to a distinct daemon process group and then forcing each to run in the main interpreter.
见:
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Processhttp://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API
否则使用如下所述的调试技巧:
Otherwise use debugging tips described in:
http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
用于获取有关应用程序正在执行的操作的堆栈跟踪.
for getting stack traces about what application is doing.
这篇关于Apache 停止处理请求 (mod_wsgi?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!