快要死的工人Flask-SocketIO + uWSGI

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

我正在尝试在我的flask项目中实现套接字的使用,随后是flask-socketio文档,我已经使其与gunicorn一起完美运行,但是发现自己无法使用uwsgi使其正常工作。即使使用最简单的应用程序和设置,它似乎也应该可以正常工作,但是无论我尝试使用哪种配置,它都只会杀死工作人员。这是我拥有的环境和代码的示例:

app.py:

from flask import Flask    
from flask_socketio import SocketIO

app = Flask(__name__)
app.config['SECRET_KEY'] = 'extremelysecret'
socketio = SocketIO(app)

if __name__ == '__main__':
    app.run()

点子冻结:

click==7.1.2
Flask==1.1.2
Flask-SocketIO==4.3.0
gevent==20.5.0
greenlet==0.4.15
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
python-engineio==3.12.1
python-socketio==4.5.1
six==1.15.0
uWSGI==2.0.18
Werkzeug==1.0.1

以文档中的示例运行:

uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file app.py --callable app

输出:

your processes number limit is 63299
your memory page size is 4096 bytes
detected max file descriptor number: 1024
- async cores set to 10 - fd table size: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :5008 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:39875 (port auto-assigned) fd 3
Python version: 3.8.0 (default, Jan  9 2020, 23:03:43)  [GCC 7.4.0]
Python main interpreter initialized at 0x55899af6a860
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 501072 bytes (489 KB) for 20 cores
*** Operational MODE: preforking+async ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55899af6a860 pid: 22479 
(default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 22479)
spawned uWSGI worker 1 (pid: 22481, cores: 10)
spawned uWSGI worker 2 (pid: 22482, cores: 10)
*** running gevent loop engine [addr:0x558998a7f860] ***
spawned uWSGI http 1 (pid: 22483)
DAMN ! worker 1 (pid: 22481) died :( trying respawn ...
Respawned uWSGI worker 1 (new pid: 22484)
DAMN ! worker 2 (pid: 22482) died :( trying respawn ...
Respawned uWSGI worker 2 (new pid: 22485)
*** running gevent loop engine [addr:0x558998a7f860] ***
DAMN ! worker 1 (pid: 22484) died :( trying respawn ...

到目前为止,我已经尝试过:

- playing with uwsgi parameters;
- using different app configurations in app.py;
- using couple different versions of python;
- figuring out is everything installed properly;

而且,我的猜测是我想念这里很明显的东西。在此先感谢您向我指出。

python flask uwsgi flask-socketio python-3.8
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.