【发布时间】:2011-12-25 13:10:08
【问题描述】:
我遇到了一个与 Python psycopg2 postgresql 驱动程序和 libgcrypt 模块相关的奇怪的生产特定错误。
我正在运行 Debian 6, 32 位以使用 uWSGI 和 Nginx 托管我的应用程序。我决定通过全新安装切换到 64 位。一切似乎都很好,除了我在 uwsgi.log 中的每个请求都低于 Python 回溯:
File ".../python2.7/site-packages/django/core/handlers/wsgi.py", line 272, in __call__
response = self.get_response(request)
File ".../python2.7/site-packages/django/core/handlers/base.py", line 169, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File ".../python2.7/site-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File ".../python2.7/site-packages/django/views/debug.py", line 59, in technical_500_response
html = reporter.get_traceback_html()
and so on...
所以,我去了 django/core/handlers/base.py(Django 版本 1.3.1)第 166 行,这似乎是最后一个异常处理程序,它拥有真正异常的一切。我将其替换为:
except Exception, why:
并将“为什么”写入文本文件。唯一的例外是:
Error loading psycopg2 module: libgcrypt.so.11: failed to map segment from shared object: Cannot allocate memory
我阅读了几乎所有类似的错误/问题/博客文章,但只能找到认为不完全相同但非常相似的问题: http://www.johngirvin.com/archives/dovecot-error-127-after-upgrading-to-debian-squeeze.html
我确实尝试过:
- Django==1.3.1
- Django==1.3
- psycopg2==2.4.2
- psycopg2==2.4.1
也重新启动,但没有结果。我在系统上安装了 postgresql-8.4、libgcrypt11 和 libgcrypt11-dev。 PostgreSQL 没有模型,除了一个新的 ./manage.py syncdb 和 Django 默认的。有一半以上的内存是空的。
而且...我还尝试在生产环境中运行 ./manage.py runserver,效果非常好。 VPS 在 Linode 上,所以我认为没有任何硬件问题。
我们将不胜感激。
【问题讨论】:
-
我想我应该向 serverfault.com 提出这个问题。可能有点晚了..有谁知道我能不能移动它?
标签: python memory-management debian 32bit-64bit psycopg2