在Django + Apache中使用memcached时出现分段错误

时间:2016-06-08 11:33:32

标签: django apache memcached mod-wsgi python-memcached

我正在使用MemcachedCache后端为Django项目配置缓存。

我在本地和预生产服务器上测试了它,它就像一个魅力。但是当我在生产服务器上部署它时,我在重启apache之后就会出现关于分段错误的多个错误,如下所示:

[mpm_prefork:notice] [pid 40094] AH00169: caught SIGTERM, shutting down
[mpm_prefork:notice] [pid 27734] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 OpenSSL/1.0.1f mod_wsgi/3.4 Python/2.7.6 configured $
[core:notice] [pid 27734] AH00094: Command line: '/usr/sbin/apache2'
[core:notice] [pid 27734] AH00052: child pid 28214 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00052: child pid 28225 exit signal Segmentation fault (11)
[crit] Memory allocation failed, aborting process.
[mpm_prefork:error] [pid 27734] (12)Cannot allocate memory: AH00159: fork: Unable to fork new process
[core:notice] [pid 27734] AH00052: child pid 28239 exit signal Aborted (6)
[core:notice] [pid 27734] AH00052: child pid 28279 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00051: child pid 28280 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[core:notice] [pid 27734] AH00052: child pid 28313 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00052: child pid 28335 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00052: child pid 28355 exit signal Segmentation fault (11)
[mpm_prefork:error] [pid 27734] (12)Cannot allocate memory: AH00159: fork: Unable to fork new process
[core:notice] [pid 27734] AH00052: child pid 28278 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00052: child pid 28336 exit signal Segmentation fault (11)
[mpm_prefork:error] [pid 27734] (12)Cannot allocate memory: AH00159: fork: Unable to fork new process
[crit] Memory allocation failed, aborting process.
...

我不明白,因为预生产服务器的内存少于生产服务器(大约一半)。

你能帮我弄清楚这种行为背后的问题或错误吗?

1 个答案:

答案 0 :(得分:-1)

使用

free -m

检查你的可用记忆。

如果您的可用内存不足,此链接https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04教程可能有助于创建交换文件。

如果您在创建交换文件后仍然遇到这些问题,您可能需要升级到更大的墨滴(但我怀疑这是你的情况)