Python mod_wsgi在压力下失效

Python mod_wsgi在压力下失效,python,linux,mod-wsgi,Python,Linux,Mod Wsgi,我试着给我的服务器施加一点压力,结果发生了一些奇怪的事情。我正在使用mod_wsgi,并插入了基本脚本: import socket def application(environ, start_response): status = '200 OK' output = 'Hello World!' response_headers = [('Content-type', 'text/plain'), ('Content-Leng

我试着给我的服务器施加一点压力,结果发生了一些奇怪的事情。我正在使用mod_wsgi,并插入了基本脚本:

import socket

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'
    response_headers = [('Content-type', 'text/plain'),
                    ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]
我试着用简单的“尽我所能”来强调它:

奇怪的事情发生了——wget向我抛出报告服务器上的错误500

当我查看apache日志时,我发现了这一点

[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25] mod_wsgi (pid=23632): Target WSGI script '/home/tricky/www/run.py' cannot be loaded as Python module.
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25] mod_wsgi (pid=23632): Exception occurred processing WSGI script '/home/tricky/www/run.py'.
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25] Traceback (most recent call last):
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]   File "/home/tricky/www/run.py", line 1, in <module>
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]     import web
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]   File "/usr/local/lib/python2.7/site-packages/web.py-0.36-py2.7.egg/web/__init__.py", line 14, in <module>
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]     import utils, db, net, wsgi, http, webapi, httpserver, debugerror
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]   File "/usr/local/lib/python2.7/site-packages/web.py-0.36-py2.7.egg/web/wsgi.py", line 8, in <module>
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]     import http
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25] ImportError: No module named http
[Sat Mar 10 21:46:18 2012][error][client 95.49.81.25]mod_wsgi(pid=23632):无法将目标wsgi脚本'/home/tricky/www/run.py'作为Python模块加载。
[Sat Mar 10 21:46:18 2012][error][client 95.49.81.25]mod_wsgi(pid=23632):处理wsgi脚本'/home/tricky/www/run.py'时发生异常。
[2012年3月10日星期六21:46:18][error][client 95.49.81.25]回溯(最近一次通话):
[Sat Mar 10 21:46:18 2012][error][client 95.49.81.25]文件“/home/tricky/www/run.py”,第1行,在
[Sat Mar 10 21:46:18 2012][error][client 95.49.81.25]导入web
[2012年3月10日星期六21:46:18][error][client 95.49.81.25]文件“/usr/local/lib/python2.7/site packages/web.py-0.36-py2.7.egg/web/_uinit_uuuuuuuuu.py”,第14行,in
[Sat Mar 10 21:46:18 2012][error][client 95.49.81.25]导入utils、db、net、wsgi、http、webapi、httpserver、debugerror
[Sat Mar 10 21:46:18 2012][error][client 95.49.81.25]文件“/usr/local/lib/python2.7/site packages/web.py-0.36-py2.7.egg/web/wsgi.py”,第8行
[Sat Mar 10 21:46:18 2012][error][client 95.49.81.25]导入http
[Sat Mar 10 21:46:18 2012][error][client 95.49.81.25]导入错误:没有名为http的模块

这怎么可能?为什么会这样呢?

好吧,我找到了解决方案——apache2在弄乱了它的配置之后,出现了一些奇怪的种族状态。
服务apache2重新启动后
一切恢复正常:)

错误表明wswgi脚本导入web,web模块依赖于http模块,而http模块在系统中找不到,并且在“正常”负载下不会发生这种情况?棘手的部分是,在正常负载下,一切正常……如果您自己找到了解决方案,请将其作为答案发布并接受。哦,您是对的@webjunkie:)完成了:D
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25] mod_wsgi (pid=23632): Target WSGI script '/home/tricky/www/run.py' cannot be loaded as Python module.
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25] mod_wsgi (pid=23632): Exception occurred processing WSGI script '/home/tricky/www/run.py'.
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25] Traceback (most recent call last):
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]   File "/home/tricky/www/run.py", line 1, in <module>
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]     import web
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]   File "/usr/local/lib/python2.7/site-packages/web.py-0.36-py2.7.egg/web/__init__.py", line 14, in <module>
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]     import utils, db, net, wsgi, http, webapi, httpserver, debugerror
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]   File "/usr/local/lib/python2.7/site-packages/web.py-0.36-py2.7.egg/web/wsgi.py", line 8, in <module>
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25]     import http
[Sat Mar 10 21:46:18 2012] [error] [client 95.49.81.25] ImportError: No module named http