【问题标题】:How to find out why uWSGI kill workers?如何找出为什么 uWSGI 杀死工人?
【发布时间】:2014-10-14 09:53:28
【问题描述】:

我在 Pyramid 上有应用程序。我使用这些配置在 uWSGI 中运行它:

[uwsgi]
socket = mysite:8055
master = true
processes = 4
vacuum = true
lazy-apps = true
gevent = 100

和 nginx 配置:

server {
    listen 8050;
    include uwsgi_params;

    location / {
        uwsgi_pass mysite:8055;
    }
}

通常一切都很好,但有时 uWSGI 会杀死工人。我也不知道为什么。

我在 uWSGI 日志中看到:

DAMN ! worker 2 (pid: 4247) died, killed by signal 9 :( trying respawn ...
Respawned uWSGI worker 2 (new pid: 4457)

但在日志中没有 Python 异常。

有时我会在 uWSGI 日志中看到:

invalid request block size: 11484 (max 4096)...skip
[uwsgi-http key: my site:8050 client_addr: 127.0.0.1 client_port: 63367] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 614]

和 nginx errors.log:

*13388 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1,
*13955 recv() failed (104: Connection reset by peer) while reading response header from upstream, client:

我认为这可以通过添加 buffer-size=32768 来解决,但由于这个 uWSGI kill workers 不太可能。

为什么 uwsgi 可以杀死工人?我怎么知道原因? “DAMN!worker 2 (pid: 4247) dead, ...”这一行没什么好说的。

【问题讨论】:

    标签: python nginx uwsgi gevent


    【解决方案1】:

    对我来说是我没有填写app.config["SERVER_NAME"] = "x"

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,对我来说,更改 uwsgi.ini 文件,将 reload-on-rss 设置的值从 2048 更改为 4048,将 harakiri 设置为 600 解决了问题。

      【讨论】:

        【解决方案3】:

        尝试在 uWSGI 配置中添加harakiri-verbose = true 选项。

        【讨论】:

          【解决方案4】:

          信号 9 表示它收到了 SIGKILL。所以有些东西杀死了你的工人。内存不足杀手决定杀死您的应用程序的可能性相对较大,因为它使用了太多内存。尝试使用进程监视器观察工作人员,看看它是否使用大量内存。

          【讨论】:

          • "尝试使用进程监视器观察工作人员,看看它是否使用大量内存"。我该怎么做?
          • 只是为某人添加:使用此 uwsgitop pypi.python.org/pypi/uwsgitop/0.10 或 htop 命令并将记录过滤到 uwsgi 并查看消耗了多少内存
          • 我不确定从 uwsgitop 命令过滤记录是如何不言而喻的。当我按照这些步骤操作时,它会在终端中自动更新屏幕,但是,当我包含 --memory-report 标志时,它确实包含内存。
          猜你喜欢
          • 2015-04-03
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-12-15
          • 1970-01-01
          • 2010-12-31
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多