我有一个在Ubuntu上运行的nginx + uWSGI + django应用程序。我启用了Harakiri。当运行触发Harakiri的长请求时,系统无法重新启动,并且出现502 Bad Gateway错误。检查uwsgi日志时,我可以看到以下条目:
probably another instance of uWSGI is running on the same address (127.0.0.1:8000).
bind(): Address already in use [core/socket.c line 779]
这是我的uwsgi配置:
--socket 127.0.0.1:8000 \
--chdir /dir/to/app/ \
--harakiri 180 \
--max-requests 2000 \
--module app.wsgi \
--limit-as 512 \
--reload-on-as \
--reload-on-rss \
--reload-mercy 8 \
--http-timeout 180 \
--disable-logging \
--ignore-write-errors \
--ignore-sigpipe \
--logto /var/log/uwsgi.log \
--die-on-term
什么可能导致此错误?我看不到任何冲突的进程在运行,如果我手动重启服务,它运行正常。
这是日志条目
*** Starting uWSGI 2.0 (64bit) on [Wed Jan 22 16:44:07 2014] ***
compiled with version: 4.4.3 on 14 January 2014 14:56:04
os: Linux-2.6.32-308-ec2 #16-Ubuntu SMP Thu Sep 16 15:25:39 UTC 2010
nodename: xxxxx.com (removed intentionally)
machine: x86_64
clock source: unix
detected number of CPU cores: 3
current working directory: /
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7732
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be
rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
probably another instance of uWSGI is running on the same address (127.0.0.1:8000).
bind(): Address already in use [core/socket.c line 779]