New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gunicorn 19.0 broken under arch/nginx #785

Closed
adontz opened this Issue Jun 13, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@adontz

adontz commented Jun 13, 2014

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.

@benoitc

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Jun 13, 2014

Owner

what is the gunicorn configuration? Can you paste it?

Owner

benoitc commented Jun 13, 2014

what is the gunicorn configuration? Can you paste it?

@adontz

This comment has been minimized.

Show comment
Hide comment
@adontz

adontz Jun 13, 2014

sure, here is my /data/django/projects/xyz/gunicorn.py

import os;

chdir = '/data/django/projects/xyz/';
raw_env = [ 'DJANGO_SETTINGS_MODULE=settings' ];

accesslog = '/var/log/gunicorn-xyz-access.log';
errorlog  = '/var/log/gunicorn-xyz-error.log';
pidfile   = '/var/run/gunicorn-xyz.pid';
loglevel  = 'debug';

bind = 'unix:/var/run/gunicorn-xyz.sock'
backlog = 16;

limit_request_line       = 1024 * 1024;
limit_request_field_size = 1024 * 1024;
limit_request_fields     =  256;

workers = 2;
max_requests = 16;

timeout = 30;
keepalive = 30;
graceful_timeout = 30;

daemon = True;

adontz commented Jun 13, 2014

sure, here is my /data/django/projects/xyz/gunicorn.py

import os;

chdir = '/data/django/projects/xyz/';
raw_env = [ 'DJANGO_SETTINGS_MODULE=settings' ];

accesslog = '/var/log/gunicorn-xyz-access.log';
errorlog  = '/var/log/gunicorn-xyz-error.log';
pidfile   = '/var/run/gunicorn-xyz.pid';
loglevel  = 'debug';

bind = 'unix:/var/run/gunicorn-xyz.sock'
backlog = 16;

limit_request_line       = 1024 * 1024;
limit_request_field_size = 1024 * 1024;
limit_request_fields     =  256;

workers = 2;
max_requests = 16;

timeout = 30;
keepalive = 30;
graceful_timeout = 30;

daemon = True;

@benoitc benoitc closed this in fd5c2e9 Jun 13, 2014

@benoitc

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Jun 13, 2014

Owner

fixed thanks!

Owner

benoitc commented Jun 13, 2014

fixed thanks!

@hnykda

This comment has been minimized.

Show comment
Hide comment
@hnykda

hnykda Jul 9, 2014

Confirm - problem fixed.

hnykda commented Jul 9, 2014

Confirm - problem fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment