【问题标题】:Could not start uwsgi process无法启动 uwsgi 进程
【发布时间】:2015-06-13 03:57:36
【问题描述】:

无法通过 ini 标志启动 uwsgi 进程

uwsgi --ini file.ini

没有任何 uwsgi pid

ps aux | grep uwsgi
root     31605  0.0  0.3   5732   768 pts/0    S+   06:46   0:00 grep uwsgi

文件.ini

[uwsgi]

chdir =/var/www/lvpp/site

wsgi-file =/var/www/lvpp/lvpp.wsgi

master = true

processes = 1

chmod-socket=664

socket = /var/www/lvpp/lvpp.sock

pidfile= /var/www/lvpp/lvpp.pid

daemonize =/var/www/lvpp/logs/lvpp.log

vacuum = true

uid = www

gid = www

env = DJANGO_SETTINGS_MODULE=settings

文件 lvpp.log

*** Starting uWSGI 2.0.10 (32bit) on [Wed Apr  8 06:46:15 2015] ***
compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-11) on 17 March   2015 21:29:09
os: Linux-2.6.32-431.29.2.el6.i686 #1 SMP Tue Sep 9 20:14:52 UTC 2014
machine: i686
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /var/www/lvpp
writing pidfile to /var/www/lvpp/lvpp.pid
detected binary path: /var/www/lvpp/site/env/bin/uwsgi
setgid() to 503
setuid() to 501
chdir() to /var/www/lvpp/site/
your processes number limit is 1812
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)
error removing unix socket, unlink(): Permission denied [core/socket.c  line 198]
bind(): Address already in use [core/socket.c line 230]

它很早就起作用了。 但是当我调用kill -9 uwsgi.pid 时,我无法再次启动uwsgi 进程。

为什么我不能再次启动 uwsgi 进程?

【问题讨论】:

    标签: python django nginx uwsgi


    【解决方案1】:

    关键是:

    error removing unix socket, unlink(): Permission denied [core/socket.c  line 198]
    

    您(很可能)以前以 root 身份运行 uwsgi 实例,创建具有 root 权限的 unix 套接字文件。

    现在您的实例(以 www 身份运行)无法重新绑定()该套接字,因为它无法取消链接(无权限)

    只需删除套接字文件并重试。

    【讨论】:

    • 注意,即使它不是 root 并且 sock 文件是 777,这也可能是问题。我不小心使用“ubuntu”用户创建了该文件,权限为 -rwxrwxrwx,这仍然导致这个错误。删除 sock 文件然后重新启动 uwsgi-emperor 为我解决了这个问题。
    【解决方案2】:

    我遇到了一个非常相似的问题,但即使在删除套接字文件后它仍然无法工作。原来这是因为 uWSGI 无法创建一个新的(它只是因为我自己运行 uwsgi 而存在)。非常简单的解决方案是chmod 包含套接字文件的目录,允许www 用户在那里创建和修改文件。现在很明显,但也许这会帮助未来的可怜的闷棍把头撞到墙上,就像我今天已经做了太多小时一样。

    root@srv16:/var/run/uwsgi> ls -la
    total 0
    drwxr-xr-x  2 root    root      60 Jul 16 07:11 .          #<-- problem
    drwxr-xr-x 25 root    root     880 Jul 19 09:14 ..
    srw-rw----  1 www-app www-data   0 Jul 16 07:11 app.socket 
                   #^-- no idea how www-app managed to create that file
    
    root@simsrv16:/var/run/uwsgi> chmod 777 .                  #<-- fix
    

    【讨论】:

    • 是的。有趣的是,它设法以某种方式启动服务并在受限用户下创建套接字,但随后未能再次删除它,直到我将包含目录更改为“为他人写”
    猜你喜欢
    • 2017-07-08
    • 1970-01-01
    • 2016-11-24
    • 2018-12-11
    • 2013-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多