Welcome! Log In Create A New Profile

Advanced

Getting error 502 when processing an excel file with many rows.

Posted by leansy 
Getting error 502 when processing an excel file with many rows.
July 28, 2012 03:13PM
Getting error 502 when processing an excel file with many rows.
Using Django / Nginx
The problem is not the weight of the file is less than 1Mb.
This page works correctly with files of 200 rows, the problem starts when the file have more rows and then, the page take too long processing this file.
This is the error:
2012/07/28 14:29:54 [error] 18515#0: *34 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /import/ HTTP/1.1", upstream: "http://127.0.0.1:9000/import/", host: "localhost:8080", referrer: "http://localhost:8080/import/"

I am using very large values ​​for the variables, but I keep getting the same error.

This is the configuration of the site:
********************************************************************************
upstream app_server {
server 127.0.0.1:9000 fail_timeout=3600s;
keepalive 3600s;
}

server {
listen 8080;
client_max_body_size 4G;
server_name localhost;

keepalive_timeout 3600s;
client_header_timeout 3600s;
client_body_timeout 3600s;
send_timeout 3600s;

location /static/ {
root /my path/;
autoindex on;
expires 7d;
}

location /media/ {
root /my path/;
autoindex on;
expires 7d;
}

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;

proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;

if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}
********************************************************************************
And this is the global configuration:
********************************************************************************
user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 3600s;
tcp_nodelay on;

client_header_timeout 3600s;
client_body_timeout 3600s;
send_timeout 3600s;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;

client_max_body_size 200m;
client_body_buffer_size 128k;

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
********************************************************************************

Can you give me some help?

Best regards
Re: Getting error 502 when processing an excel file with many rows.
November 10, 2012 05:48AM
Hi leansy,

I had the same problem. Did you find a way to solve this ?

Thanks in advance,
Josir
Re: Getting error 502 when processing an excel file with many rows.
November 12, 2012 06:53AM
Hi, I never found the solution, I changed all the code, now I using celery for deal with excel processing method.
Re: Getting error 502 when processing an excel file with many rows.
November 12, 2012 07:15AM
Thanks for replying leansy.

I think I found how to fix - I posted the solution on your question on stackoverflow:

http://stackoverflow.com/questions/6816215/gunicorn-nginx-timeout-problem/9931216

Good Luck!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 202
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready