com*_*ex3 5 python sockets nginx flask uwsgi
我运行我的烧瓶应用程序,它运行良好,但到应用程序停止时和我的uwsgi日志
probably another instance of uWSGI is running on the same address (127.0.0.1:9002).
bind(): Address already in use [core/socket.c line 764]
Run Code Online (Sandbox Code Playgroud)
当我运行触摸touch_reload时,应用程序再次运行.我在服务器上运行其他任何可能接受套接字的东西.
我的conf:
nginx
server {
listen 80;
....
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9001;
}
....
}
server {
listen 80;
....
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9003;
}
....
}
uwsgi:
chdir = /var/www/../
module = wsgihandler
socket = 127.0.0.1:9003
wsgi-file = app/__init__.py
callable = app
master = true
chmod-socket = 664
uid = root
gid = root
processes = 4
socket-timeout = 180
post-buffering = 8192
max-requests = 1000
buffer-size = 32768
logto = /var/www/.../log/uwsgi.log
touch-reload = /var/www/.../touch_reload
Run Code Online (Sandbox Code Playgroud)
cut*_*eth 13
此错误表示端口9002已被其他进程使用.根据您的日志,该过程是uwsgi probably another instance of uWSGI is running on the same address (127.0.0.1:9002)
.可能是当您停止使用应用程序时未释放端口,并且在运行时重新启动了wsgi服务器touch touch_reload
.您可以尝试以下命令来释放端口.
sudo fuser -k 9002/tcp
Run Code Online (Sandbox Code Playgroud)
如果这是一个tcp进程并再次重新启动wsgi服务器以查看该端口是否已被使用.
也许您可以通过 crtl + z 停止 uwsgi:
$ lsof -i:8000
结果可能是:
COMMAND PID USER FD TYPE ...
uwsgi 9196 xxx 4u xxx ...
Run Code Online (Sandbox Code Playgroud)
然后
$杀9196
我有同样的问题,但问题出在 sqlalchemy 中,尝试添加以下内容:
@app.teardown_request
def shutdown_session(exception=None):
from extension import db
db.session.remove()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9871 次 |
最近记录: |