7
我试图强调我的服务器一点,发生了一些奇怪的事情。我使用mod_wsgi的,基本的脚本插上电源: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]
我想强调这一点用简单的“打我所能”:
#!/bin/zsh
for i in {1..50}
do
wget http://$this_site/ &
done
而且奇怪的事情发生了 - 抛出的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
这怎么可能?为什么会发生?
错误指出您的wswgi脚本导入了网页,而网页模块依赖于http模块,这在系统中找不到 – 2012-03-10 21:20:48
而且,这不会在'normal'下发生,加载? – 2012-03-10 22:42:35
棘手的部分是,在正常的负载下一切正常工作... – Bugari 2012-03-11 09:24:15