With a graceful signal, nginx drops the connection, refusing when trying to connect to the uWSGI connector

This problem puzzles me because I seem to be following everything in the documents that will allow an elegant restart.

I run uWSGI in Emperor mode, with a bunch of vassals. When I try to gracefully restart one of the vassals, I get a response of nginx 502 Bad Gateway about half a second. Here is some info:

One of my vassal.ini files:

 [uwsgi] master = true processes = 2 home = /var/www/.virtualenvs/www.mysite.com socket = /tmp/uwsgi.sock.myapp pidfile = /tmp/uwsgi.pid.myapp module = myapp pythonpath = /var/www/www.mysite.com/mysite logto = /var/log/uwsgi/myapp.log chmod-socket = 666 vacuum = true gid = www-data uid = www-data 

Then I want to gracefully restart this process:

 kill -HUP `cat /tmp/uwsgi.pid.myapp` 

Exiting a vassal log file looks good (I think?)

 ...gracefully killing workers... Gracefully killing worker 1 (pid: 29957)... Gracefully killing worker 2 (pid: 29958)... binary reloading uWSGI... chdir() to /var/www/www.mysite.com/vassals closing all non-uwsgi socket fds > 2 (max_fd = 1024)... found fd 3 mapped to socket 0 (/tmp/uwsgi.sock.kilroy) running /var/www/.virtualenvs/www.mysite.com/bin/uwsgi *** has_emperor mode detected (fd: 15) *** [uWSGI] getting INI configuration from kilroy.ini open("/var/log/uwsgi/kilroy.log"): Permission denied [utils.c line 250] unlink(): Operation not permitted [uwsgi.c line 998] *** Starting uWSGI 1.2.3 (64bit) on [Fri Jun 8 09:15:10 2012] *** compiled with version: 4.6.3 on 01 June 2012 09:56:19 detected number of CPU cores: 2 current working directory: /var/www/www.mysite.com/vassals writing pidfile to /tmp/uwsgi.pid.kilroy detected binary path: /var/www/.virtualenvs/www.mysite.com/bin/uwsgi setgid() to 33 setuid() to 33 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock.kilroy fd 3 Python version: 2.7.3 (default, Apr 20 2012, 23:04:22) [GCC 4.6.3] Set PythonHome to /var/www/.virtualenvs/www.mysite.com *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x19e3e90 your server socket listen backlog is limited to 100 connections *** Operational MODE: preforking *** added /var/www/www.mysite.com/gapadventures/ to pythonpath. WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x19e3e90 pid: 30041 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 30041) spawned uWSGI worker 1 (pid: 30042, cores: 1) spawned uWSGI worker 2 (pid: 30043, cores: 1) 

But when I try to quickly access the site, my nginx log gets this result:

 2012/06/08 09:44:43 [error] 5885#0: *873 connect() to unix:///tmp/uwsgi.sock.kilroy failed (111: Connection refused) while connecting to upstream, client: 10.100.50.137, server: mydomain.com, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/uwsgi.sock.kilroy:", host: "mydomain.com" 

This happens about half a second after sending a signal, so this is clearly not very graceful.

Any tips? Many thanks!

+4
source share
1 answer

Fix socket path in nginx and uWSGI configuration. Sockt must be identical

Was

 unix:///tmp/uwsgi.sock.kilroy 

or

 /tmp/uwsgi.sock.myapp 

It is required:

Nginx

 unix:/tmp/uwsgi.sock.myapp 

and

uwsgi

 socket = /tmp/uwsgi.sock.myapp 
0
source