我在我的 uWSGI 日志中得到了以下回溯,我不知道从哪里开始寻找答案:
DAMN ! worker 5 (pid: 29056) died :( trying respawn ...
Respawned uWSGI worker 5 (new pid: 29088)
DAMN ! worker 6 (pid: 29080) died :( trying respawn ...
Respawned uWSGI worker 6 (new pid: 29089)
!!! uWSGI process 29089 got Segmentation Fault !!!
*** backtrace of 29089 ***
uwsgi(uwsgi_backtrace+0x2e) [0x468a9e]
uwsgi(uwsgi_segfault+0x21) [0x468e61]
/lib/x86_64-linux-gnu/libc.so.6(+0x36d40) [0x7f74aa424d40]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(_PyType_Lookup+0x19d) [0x7f74aa97572d]
...
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x7d30d) [0x7f74aa83130d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7f74aa8dde23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x12e5f5) [0x7f74aa8e25f5]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7f74aa8dde23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_CallObjectWithKeywords+0x47) [0x7f74aa89c837]
uwsgi(python_call+0x11) [0x47b011]
uwsgi(uwsgi_request_wsgi+0x116) [0x47d206]
uwsgi(wsgi_req_recv+0x8e) [0x41e64e]
uwsgi(simple_loop_run+0xc4) [0x465084]
uwsgi(uwsgi_ignition+0x194) [0x4690b4]
uwsgi(uwsgi_worker_run+0x2dd) [0x46d88d]
uwsgi(uwsgi_run+0x3b4) [0x46ddb4]
uwsgi(_start+0) [0x41dd1e]
*** end of backtrace ***
我在 Ubuntu 14.04 LTS 上运行 uWSGI 版本 2.0.9 以及 django 1.7.4 和 nginx 1.6。这是我的 uWSGI 应用程序配置:
module=project.wsgi:application
socket=127.0.0.1:7001
pidfile=/tmp/project-master.pid
master=True
vacuum=True
enable-threads=True
disable-logging=True
#limit-as=4096 # can cause problems with some application (especially on 64bit)?
max-requests=8192
processes=12
listen=12000
idle = 3600
stats=127.0.0.1:1717
memory-report = True
这是 nginx 配置:
worker_processes 8; # 12 cores
worker_rlimit_nofile 100000;
pid /var/run/nginx.pid;
events {
worker_connections 16384;
use epoll;
multi_accept on;
}
...
此外有时还会出现以下错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 199, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 243, in handle_uncaught_exception
return callback(request, **param_dict)
File "./project/utils/utils.py", line 137, in error500
return error(request, status_code, description)
File "./project/utils/utils.py", line 127, in error
response = render(request, 'error.html.jinja', {'description': description })
File "/usr/local/lib/python2.7/dist-packages/django/shortcuts.py", line 50, in render
return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 178, in render_to_string
return t.render(context_instance)
File "/usr/local/lib/python2.7/dist-packages/django_jinja/base.py", line 139, in render
return super(Template, self).render(new_context)
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 982, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 746, in handle_exception
reraise(exc_type, exc_value, tb)
File "/var/www/pixabay/pixabay/project/templates/error.html.jinja", line 1, in top-level template code
{% extends "base.html.jinja" %}
File "/var/www/pixabay/pixabay/project/templates/base.html.jinja", line 37, in top-level template code
{% spaceless %}
File "./project/utils/templatetags/jinga2_extensions.py", line 61, in _strip_spaces
return strip_spaces_between_tags(caller().strip())
File "/var/www/pixabay/pixabay/project/templates/base.html.jinja", line 51, in template
{% if request.user.is_authenticated() %}
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 400, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'django.core.handlers.wsgi.WSGIRequest object' has no attribute 'user'
该代码在具有 6 个内核和 ubuntu 12.04 LTS 的机器上运行没有错误...任何想法都很好...谢谢
答案1
这是由于未绑定的写入导致的。此错误已在 1.0 中修复,请升级https://pypi.python.org/pypi/xxtea/1.0
感谢您报告该问题。