uWSGI TCP/IP host:port vs Unix socket

5,041

I have also met this question. My uwsgi log errors are like you, meanwhile I found there are alert logs in my nginx error log, like: "2017/05/16 18:09:33 [alert] 16405#0: 1024 worker_connections are not enough"

So I increased worker_connections to high value in nginx conf file.

Share:
5,041

Related videos on Youtube

Barmi
Author by

Barmi

Updated on September 18, 2022

Comments

  • Barmi
    Barmi over 1 year

    We are running a Python WSGI server (uWSGI) and changed to socket file instead of a tcp/ip localhost:port connection.

    Now our uwsgi logs are full of errors like

    IOError: write error
    SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) during GET /en/photos/?orientation... (ip ...) !!!
    uwsgi_response_write_headers_do(): Broken pipe [core/writer.c line 296] during GET /en/photos/?orientation... (ip ...)
    

    Changing back to localhost:port and no errors in the logs. The pages are loading with both configurations.

    We would prefer Unix sockets because they are a little bit faster... Has anyone a clue what's causing this errors?

    uwsgi.ini:

    daemonize = /var/log/uwsgi/debug.log
    module = project.wsgi:application
    
    socket=127.0.0.1:1111
    
    #socket = /tmp/tmp.sock
    #chmod-socket = 666
    
    master = true
    vacuum = true
    
    chdir=/var/www/...
    pidfile=/tmp/project-master.pid
    
    enable-threads = true
    disable-logging = true
    
    processes=6
    

    nginx.conf

    location / {
        uwsgi_read_timeout 300;
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:1111;
        #uwsgi_pass unix:/tmp/tmp.sock;
    }
    
    • silpol
      silpol almost 7 years
      for what it is worth this late and judging by snippets, you have actually commented out Unix socket related lines and added TCP socket related lines. Probably this was just misunderstanding but it certainly caused you to have outcome you describe.