uWSGI“信号队列已满”错误

问题描述 投票:0回答:1

我有一个与uWSGI一起运行的Django应用程序。

有时,当重新启动uWSGI服务时,出现一堆*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***错误。

发生这种情况时,我无法访问Django应用。再次重新启动uWSGI通常是可行的。

任何想法在这里发生了什么?

在启动应用程序时,我有一堆初始化的cron和计时器,例如:

@uwsgidecorators.timer(30)
def send_queued_mail(*args, **kwargs):

  ...

wsgi进程的完整输出如下:

chdir() to /etc/uwsgi/vassals
closing all non-uwsgi socket fds > 2 (max_fd = 1024)...
found fd 3 mapped to socket 0 (/var/run/uwsgi/MY_APP.sock)
running /usr/local/bin/uwsgi
*** has_emperor mode detected (fd: 7) ***
[uWSGI] getting INI configuration from MY_APP.ini
*** Starting uWSGI 2.0.17.1 (64bit) on [Thu Feb  6 22:22:18 2020] ***
compiled with version: 4.8.4 on 07 August 2018 17:29:43
os: Linux-4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016
nodename: spuzzum
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /opt/MY_APP
your processes number limit is 128614
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 inherited UNIX address /var/run/uwsgi/MY_APP.sock fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.6.7 (default, Oct 21 2018, 00:00:00)  [GCC 4.8.4]
Set PythonHome to /opt/MY_APP/venv/MY_APP-3.6
Python main interpreter initialized at 0x24b1a00
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 609552 bytes (595 KB) for 5 cores
*** Operational MODE: preforking ***
*** Starting uWSGI 2.0.17.1 (64bit) on [Thu Feb  6 22:22:21 2020] ***
compiled with version: 4.8.4 on 07 August 2018 17:29:43
os: Linux-4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016
nodename: spuzzum
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /opt/MY_APP
your processes number limit is 128614
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 inherited UNIX address /var/run/uwsgi/MY_APP.sock fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.6.7 (default, Oct 21 2018, 00:00:00)  [GCC 4.8.4]
Set PythonHome to /opt/MY_APP/venv/MY_APP-3.6
Python main interpreter initialized at 0x24b1a00
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 609552 bytes (595 KB) for 5 cores
*** Operational MODE: preforking ***
*** Starting uWSGI 2.0.17.1 (64bit) on [Thu Feb  6 22:22:21 2020] ***
compiled with version: 4.8.4 on 07 August 2018 17:29:43
os: Linux-4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016
nodename: spuzzum
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /opt/MY_APP
your processes number limit is 128614
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /var/run/uwsgi/MY_APP.sock fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.6.7 (default, Oct 21 2018, 00:00:00)  [GCC 4.8.4]
Set PythonHome to /opt/MY_APP/venv/MY_APP-3.6
Python main interpreter initialized at 0x10899e0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 609552 bytes (595 KB) for 5 cores
*** Operational MODE: preforking ***
*** has_emperor mode detected (fd: 7) ***
unable to load configuration from from multiprocessing.semaphore_tracker import main;main(17)
[uwsgi-signal] signum 0 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 1 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 2 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 3 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 4 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 5 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 6 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 7 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 8 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 9 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 10 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 11 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 12 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 13 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 14 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 15 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 16 registered (wid: 0 modifier1: 0 target: default, any worker)
WSGI app 0 (mountpoint='') ready in 11 seconds on interpreter 0x10899e0 pid: 8515 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 8515)
spawned uWSGI worker 1 (pid: 8548, cores: 1)
spawned uWSGI worker 2 (pid: 8549, cores: 1)
spawned uWSGI worker 3 (pid: 8550, cores: 1)
spawned uWSGI worker 4 (pid: 8551, cores: 1)
spawned uWSGI worker 5 (pid: 8552, cores: 1)
*** Stats server enabled on /tmp/MY_APP-stats.socket fd: 23 ***
subprocess 8540 exited with code 1
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 14 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 0 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 0 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 13 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 14 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
django ubuntu uwsgi
1个回答
0
投票

似乎重复的计时器可能引起了问题。解决方案是在加载WSGI应用程序之前导入计时器。我的uwsgi ini文件现在看起来像:

[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /opt/%n
# Django's wsgi file
module          = MY_APP.wsgi
import          = MY_APP.processes.production
...

其中MY_APP.processes.production包含我所有的.cron.timer声明。

这是在https://github.com/unbit/uwsgi/issues/2123中向我建议的,也可以从文档https://uwsgi-docs.readthedocs.io/en/latest/PythonDecorators.html的第一个示例中找到。

© www.soinside.com 2019 - 2024. All rights reserved.