Skip to content

gunicorn 19.0 broken under arch/nginx #785

@adontz

Description

@adontz

I have nginx (from pacman) under archlinux with the following config

proxy_temp_path                    /var/tmp/nginx/temp;
proxy_cache_path                   /var/tmp/nginx/cache keys_zone=default_path:100m;
proxy_connect_timeout              5;
proxy_read_timeout                 5;
proxy_redirect                     off;
proxy_set_header                   Host $http_host;
proxy_set_header                   X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header                   X-Real-IP $remote_addr;
proxy_set_header                   X-Scheme $scheme;
proxy_set_header                   REMOTE_ADDR $remote_addr;
proxy_http_version                 1.1;
proxy_pass_header                  Server;
....
upstream gunicorn_xyz_server {
    server unix:/var/run/gunicorn-xyz.sock max_fails=1 fail_timeout=10 weight=1;
}

location ^~/pages/ {
    limit_except               GET HEAD { deny all; }
    expires 24h;

    proxy_pass                 http://gunicorn_xyz_server;
    proxy_cache                default_path;
    proxy_cache_key            "$server_name$request_uri";
    proxy_cache_valid          200 1d;
    proxy_cache_use_stale      error timeout updating http_500;
}

gunicorn (from pip) is run as service with the following config

[Unit]
Description=gunicorn xyz daemon

[Service]
Type=forking
PIDFile=/var/run/gunicorn-xyz.pid
User=root
WorkingDirectory=/usr/bin
ExecStart=/usr/bin/gunicorn --config /data/django/projects/xyz/gunicorn.py wsgi:application
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID

[Install]
WantedBy=multi-user.target

After upgrading to 19.0 I get the following error

2014-06-13 09:37:58 [3163] [ERROR] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/gunicorn/workers/sync.py", line 93, in handle
    self.handle_request(listener, req, client, addr)
  File "/usr/lib/python3.4/site-packages/gunicorn/workers/sync.py", line 125, in handle_request
    listener.getsockname(), self.cfg)
  File "/usr/lib/python3.4/site-packages/gunicorn/http/wsgi.py", line 163, in create
    environ['REMOTE_ADDR'] = client[0]
IndexError: index out of range

simply downgrading to 18.0 helps.

If that matters gunicorn serves django web site.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions